Forum Replies Created

Viewing 15 replies - 31 through 45 (of 56 total)
  • Thread Starter David Bee

    (@davidbawiec)

    Ah. Totally see the goal there. And wish that could be possible! ??
    Sadly, in the case I’m talking above, the plugin already implements Select2 and modifies it’s style internally. So ACF-Extended ends up overriding some of those settings, thus resulting in a mess.

    To be fair though, if this seems to be a rarity that would cause you more of a headache to fix, I can also override the modifications locally. It’s no big deal. Let me know.

    Have a great weekend!
    Thanks!
    David

    Thread Starter David Bee

    (@davidbawiec)

    Ah! I’ve found the issue in my logic!! It was totally my fault.
    You’re right things work like a charm. Thanks.

    Since I’ve got you, I’m wondering if you can shed any advice. So I’m trying to dynamically create the ACF form with certain field_groups. Rather than using keys, I rather use field group names and retrieve the key for each name.

    To retrieve the key of a field group, when they were defined the regular ACF wp-admin way, I used to do this:
    $field_group_IDs[] = get_page_by_title( $field_group_name, OBJECT, 'acf-field-group' )->ID;

    Which of course doesn’t work when I’ve now switched to registering the field groups locally via php. So the way I’ve found to find them from the local store is as follows:

    $field_group = acf_get_local_store( 'groups' )->query( array( 'title' => $field_group_name ) );
    $field_group_key = array_key_first($field_group);

    Does this seem like the most efficient way of retrieving these?

    Thanks!
    David

    • This reply was modified 4 years, 10 months ago by David Bee.
    Thread Starter David Bee

    (@davidbawiec)

    Thanks for the tremendously fast response!

    I’m using the acf_form() function to create the front-end form. https://www.advancedcustomfields.com/resources/create-a-front-end-form/

    Thread Starter David Bee

    (@davidbawiec)

    Hmm.

    So I don’t think I was clear in my previous message as I think we misunderstood each other.

    Upon looking through the plugin’s code, I can see that your input-script.js eventually triggers not only the Advanced Custom Fields WordPress Media upload modal, but ultimately the openModal() function, which handles the rest of ACF Image Aspect Ratio Crop’s actions (opening the modal, cropping the file, updating the attachment, etc).

    So in theory, wouldn’t work if I were to create a dropzone field which on success triggers the same openModal() function?

    Thanks.

    PS- and of course I’d be happy to do a pull request so that this could get incorporated into the plugin.

    • This reply was modified 4 years, 10 months ago by David Bee.
    Thread Starter David Bee

    (@davidbawiec)

    That’s marvelous news! Looking forward to the fix!

    Also, may I say: I love you Trello gifs. ??

    Cheers!
    David

    Thread Starter David Bee

    (@davidbawiec)

    On a side note, while you’re checking this out, one more thing I did notice is that what gets deleted are the cropped versions, not the original uploads or the various thumbnails. This may be an issue with the bug described above. But while you’re looking, can you make sure that original versions will also get deleted?

    Thanks!
    David

    Thread Starter David Bee

    (@davidbawiec)

    Hi!

    I’m finally back and updated to the latest version of the plugin. I tested this and have good news/bad news. The good news: The deleting of the cropped version is working great. The bad news: the cropped version gets deleted as the file is being saved. So it never saves correctly. I looked through the code and looks like you save debugging info, so here’s the output.

    [13-Mar-2020 10:03:45 UTC] post_id
    [13-Mar-2020 10:03:45 UTC] user_651
    [13-Mar-2020 10:03:45 UTC] POST
    [13-Mar-2020 10:03:45 UTC] Array
    (
        [_wpnonce] => 24bb6c48eb
        [_wp_http_referer] => /wp-admin/user-edit.php?user_id=651&updated=1&wp_http_referer=%2Fwp-admin%2Fusers.php%3Fs%3D650%26action%3D-1%26new_role%26rcp_bulk_membership%255B0%255D%26rcp_bulk_membership%255B1%255D%26paged%3D1%26action2%3D-1%26new_role2
        [wp_http_referer] => /wp-admin/users.php?s=650&action=-1&new_role&rcp_bulk_membership%5B0%5D&rcp_bulk_membership%5B1%5D&paged=1&action2=-1&new_role2
        [from] => profile
        [checkuser_id] => 644
        [admin_bar_front] => 1
        [role] => customer
        [first_name] => Celine
        [last_name] => Dion
        [nickname] => Celine Dion
        [display_name] => Celine Dion
        [description] => Near, far, wherever you are, I believe that the heart does go on. Once more you open the door And you\'re here in my heart And my heart will go on and on.
        [pass1] => 
        [pass2] => 
        [_acf_screen] => user
        [_acf_post_id] => user_651
        [_acf_validation] => 1
        [_acf_nonce] => 
        [_acf_changed] => 1
        [aiarc_temp_post_id] => 80f69d32-91c8-47fa-96e2-84ce82250c64
        [acf] => Array
            (
                [field_5e1d6e4b050e2] => No preference
                [field_5df8aecc1a7d5] => no
                [field_5e6ad5f5accbe] => Array
                    (
                        [0] => English
                    )
                [field_5d9028ca99a6b] => Array
                    (
                        [row-0] => Array
                            (
                                [field_5d95802b1d09a] => 7949
                                [field_5d9028f299a6c] => Jim
                                [field_5d90293299a6d] => 20190417
                                [field_5d95b713e50c0] => he/him/his
                                [field_5daea36c0f941] => Male
                                [field_5daeb2f0b40bc] => 
                                [field_5daeb5d1895ea] => 0
                                [field_5daca11bbc30b] => 
                                [field_5d90298e99a6e] => 
                                [field_5d9029f199a6f] => Adorable. Loves singing.
                                [field_5e6704dbc7037] => 5e6706cb39068
                            )
    
                        [row-1] => Array
                            (
                                [field_5d95802b1d09a] => 9596
                                [field_5d9028f299a6c] => Jack Jack
                                [field_5d90293299a6d] => 20070419
                                [field_5d95b713e50c0] => they/them/theirs
                                [field_5daea36c0f941] => Non-binary
                                [field_5daeb2f0b40bc] => 
                                [field_5daeb5d1895ea] => 0
                                [field_5daca11bbc30b] => 
                                [field_5d90298e99a6e] => 
                                [field_5d9029f199a6f] => The black sheep of the family. Will not listen to anything you say unless you give him cheesecake. Be careful. Sometimes self-combusts.
                                [field_5e6704dbc7037] => 5e6706cb3e545
                            )
    
                        [row-2] => Array
                            (
                                [field_5d95802b1d09a] => 7954
                                [field_5d9028f299a6c] => Clair
                                [field_5d90293299a6d] => 20151028
                                [field_5d95b713e50c0] => she/her/hers
                                [field_5daea36c0f941] => Female
                                [field_5daeb2f0b40bc] => Array
                                    (
                                        [0] => Autism Spectrum
                                        [1] => Intellectual / Cognitive
                                    )
    
                                [field_5daeb3feb40bd] => Needs assistance getting up from the sofa. Please don\'t make loud noises as they may scare her.
                                [field_5daeb5d1895ea] => 1
                                [field_5daeb7481e818] => Fluffy
                                [field_5daca11bbc30b] => 
                                [field_5d90298e99a6e] => Allergic to squirrels.
                                [field_5d9029f199a6f] => She really loves squirrels.
    So there\'s the problem... ;)
                                [field_5e6704dbc7037] => 5e6706cb447a0
                            )
    
                    )
    
                [field_5daf6d90597b0] => 
                [field_5e6aee753ee1b] => 
                [field_5e18760202024] => https://facebook.com/celinedion
                [field_5e18760202059] => https://twitter.com/celinedion
                [field_5e18760202083] => https://www.instagram.com/celinedion
                [field_5e187602020af] => https://youtube.com/celinedion
            )
    
        [app_name] => 
        [app_email] => 
        [app_phone] => 
        [app_address] => 
        [app_city] => 
        [wpfront-secondary-roles] => Array
            (
                [wpamelia-customer] => on
                [wpamelia-provider] => on
            )
    
        [wp-user-avatar] => 7914
        [action] => update
        [user_id] => 651
        [submit] => Update User
    )
    
    [13-Mar-2020 10:03:45 UTC] found following post attachments
    [13-Mar-2020 10:03:45 UTC] Array
    (
        [0] => WP_Post Object
            (
                [ID] => 9596
                [post_author] => 644
                [post_date] => 2020-03-13 06:03:21
                [post_date_gmt] => 2020-03-13 10:03:21
                [post_content] => 
                [post_title] => jackjack-aspect-ratio-1x1
                [post_excerpt] => 
                [post_status] => inherit
                [comment_status] => open
                [ping_status] => closed
                [post_password] => 
                [post_name] => jackjack-aspect-ratio-1x1
                [to_ping] => 
                [pinged] => 
                [post_modified] => 2020-03-13 06:03:21
                [post_modified_gmt] => 2020-03-13 10:03:21
                [post_content_filtered] => 
                [post_parent] => 0
                [guid] => https://local.###############.com/jackjack-aspect-ratio-1x1/
                [menu_order] => 0
                [post_type] => attachment
                [post_mime_type] => image/jpeg
                [comment_count] => 0
                [filter] => raw
            )
    
    )
    
    [13-Mar-2020 10:03:45 UTC] found following fields
    [13-Mar-2020 10:03:45 UTC] Array
    (
        [field_5e1d6e4b050e2] => No preference
        [field_5df8aecc1a7d5] => no
        [field_5e6ad5f5accbe] => Array
            (
                [0] => English
            )
        [field_5d9028ca99a6b] => Array
            (
                [row-0] => Array
                    (
                        [field_5d95802b1d09a] => 7949
                        [field_5d9028f299a6c] => Jim
                        [field_5d90293299a6d] => 20190417
                        [field_5d95b713e50c0] => he/him/his
                        [field_5daea36c0f941] => Male
                        [field_5daeb2f0b40bc] => 
                        [field_5daeb5d1895ea] => 0
                        [field_5daca11bbc30b] => 
                        [field_5d90298e99a6e] => 
                        [field_5d9029f199a6f] => Adorable. Loves singing.
                        [field_5e6704dbc7037] => 5e6706cb39068
                    )
    
                [row-1] => Array
                    (
                        [field_5d95802b1d09a] => 9596
                        [field_5d9028f299a6c] => Jack Jack
                        [field_5d90293299a6d] => 20070419
                        [field_5d95b713e50c0] => they/them/theirs
                        [field_5daea36c0f941] => Non-binary
                        [field_5daeb2f0b40bc] => 
                        [field_5daeb5d1895ea] => 0
                        [field_5daca11bbc30b] => 
                        [field_5d90298e99a6e] => 
                        [field_5d9029f199a6f] => The black sheep of the family. Will not listen to anything you say unless you give him cheesecake. Be careful. Sometimes self-combusts.
                        [field_5e6704dbc7037] => 5e6706cb3e545
                    )
    
                [row-2] => Array
                    (
                        [field_5d95802b1d09a] => 7954
                        [field_5d9028f299a6c] => Clair
                        [field_5d90293299a6d] => 20151028
                        [field_5d95b713e50c0] => she/her/hers
                        [field_5daea36c0f941] => Female
                        [field_5daeb2f0b40bc] => Array
                            (
                                [0] => Autism Spectrum
                                [1] => Intellectual / Cognitive
                            )
    
                        [field_5daeb3feb40bd] => Needs assistance getting up from the sofa. Please don\'t make loud noises as they may scare her.
                        [field_5daeb5d1895ea] => 1
                        [field_5daeb7481e818] => Fluffy
                        [field_5daca11bbc30b] => 
                        [field_5d90298e99a6e] => Allergic to squirrels.
                        [field_5d9029f199a6f] => She really loves squirrels.
    So there\'s the problem... ;)
                        [field_5e6704dbc7037] => 5e6706cb447a0
                    )
    
            )
    
        [field_5daf6d90597b0] => 
        [field_5e6aee753ee1b] => 
        [field_5e18760202024] => https://facebook.com/celinedion
        [field_5e18760202059] => https://twitter.com/celinedion
        [field_5e18760202083] => https://www.instagram.com/celinedion
        [field_5e187602020af] => https://youtube.com/celinedion
        [field_5db1289e27c55] => Array
            (
                [row-0] => Array
                    (
                        [field_5db128c827c56] => Samantha
                        [field_5db1290727c57] => Sister
                    )
    
            )
    
    )
    
    [13-Mar-2020 10:03:45 UTC] preserve ids
    [13-Mar-2020 10:03:45 UTC] Array
    (
    )
    
    [13-Mar-2020 10:03:45 UTC] all ids
    [13-Mar-2020 10:03:45 UTC] Array
    (
        [0] => 9596
    )
    
    [13-Mar-2020 10:03:45 UTC] delete ids
    [13-Mar-2020 10:03:45 UTC] Array
    (
        [0] => 9596
    )
    
    

    It looks like the $preserve_ids ends up being empty. Which is probably part of the cause of the problem.

    Let me know what you find!
    Thanks!
    David

    Thread Starter David Bee

    (@davidbawiec)

    @iminbali I actually also had exactly the same issue on Bluehost. I contacted them and they disabled that particular firewall rule on our account.

    @adamjlea Thanks for the super quick response! remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 ); worked like a charm! Thanks!

    Thread Starter David Bee

    (@davidbawiec)

    Fantastic! Would be happy to test and report things back! Thanks.

    Great re-write! Cheers!

    Thread Starter David Bee

    (@davidbawiec)

    Hi @nsinelnikov,

    Thanks for the reply. As much as your suggested workaround may work for my own forms, I see four different third-party plugins on our site that hook into admin_post_{action_name}. So your workaround won’t solve the issue. I much prefer we find a solution to how/when UM creates the redirect to make sure it doesn’t interfere with these plugins (and so many more which have been discussed on the forum here).

    admin_post_{action_name} is the basic form equivalent to how you can hook into wp_ajax_{action_name} for Ajax requests. And just like there’s a wp_ajax_nopriv_{action_name} that triggers for non-logged in users, admin_post has an equivalent as well: admin_post_nopriv_{action_name}. In fact UM hooks into wp_ajax_nopriv_{action_name} on multiple occasions. So you can see how it can be used as part of frontend forms. I can see how the word ‘admin’ makes it confusing though. In this case, admin should be thought of more administrative rather than an administrator.

    I skimmed through the code and it looks like wp-admin/admin-post.php doesn’t get to processing the POST action hooks till after wp-load.php and wp-admin/includes/admin.php are loaded. Which (if I’m not mistaken) means that UM triggers its redirect before we get to the hooks?

    Thread Starter David Bee

    (@davidbawiec)

    I ended up finding the _simpay_payment_confirmation hook and using that. Seems to have done the trick. From what I could see, this one gets triggered after successful payment happens. Is that correct?

    Thread Starter David Bee

    (@davidbawiec)

    I’ve managed to figure out how to get the dynamic amount working:

    add_filter( 'simpay_amount', array( $this, 'override_simpay_amount' ), 20, 1 );
    public function override_simpay_amount() {
    	return $stripe_appointment_booking_total_fee;;
    }

    This works well.

    I’ve managed to get the metadata working, as well as even passing the saved Stripe Customer ID using the simpay_get_session_args_from_payment_form_request filter.

    However, I’m still unable to take actions after successful payment. Previously I was able to use add_action('simpay_charge_created','my_action'); This is now again considered a legacy hook. And a broken one. So what has replaced it? I tried 'simpay_after_paymentintent_response_from_payment_form_request'. No luck. I need to run some database actions after successful payment. How can I achieve that?

    @miroh BRILLIANT! Thank you for all your hard work in updating the plugin and making it PHP7 compatible! All your changes are spot on. May I just recommend an alteration to /wp-download-codes/includes/admin/manage-codes.php lines 31-41. Currently, the code tries to evaluate and assign the $release_id variable, but it doesn’t check if there are any releases in the database until much later in the code. Which means that when the plugin is first installed, a visit to this page results in a notice, because both conditions on line 31 come back positive thus it tries to execute line 32, but $releases is an empty array because there are no releases in the database yet. Which means $releases[0]->ID throws a PHP notice.

    The workaround for this could be adding a check before line 31 for the following:

    if ( ! $releases ) {
        $release_id = '';
    }

    Alternately it could be done as:

    if ( count( $releases ) == 0 ) {
        $release_id = '';
    }

    Then continuing all the other conditions as elseif.

    Thoughts?

    Thread Starter David Bee

    (@davidbawiec)

    Great suggestions, Dave! Thank you! For now, option 3 worked great. Will look into creating official certificates for the local development servers.

    Thanks!

Viewing 15 replies - 31 through 45 (of 56 total)