Support Forum ยป User Profile

Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • in reply to: Why wouldn't this update the data? #39928
    Amy SchmidtAmy Schmidt
    Participant

    Hmm, there was a script written before I got here that converted cloned data to unserialized data into their custom fields. That could likely be causing some issues.

    However, you did give me an idea I wish I thought of for debugging. Not sure why I didn't think of creating a test entry to play with that. I did that and saw all the ways I was updating PM wasn't inputting it correctly.

    I did notice the correct PM serialized data was formatted just like above:

    Array
    (
        [0] => Array
            (
                [available] => 2022-09-01
            )
    
        [1] => Array
            (
                [available] => 2022-10-05
            )
    
    )
    

    So I just tried a non-loop basic

    update_post_meta($id, 'field', $array)

    and poof, updated properly! I was overthinking it.

    And now to do some fun (sarcasm) stuff like adding extra features through javascript that the former dev hardcoded into the metabox files. I don't think there are any hooks for that, but I'll make it work.

    Thanks for your help!

    in reply to: Holding fields for review #39156
    Amy SchmidtAmy Schmidt
    Participant

    I was worried you were going to say that, so I thought of an alternative. Seeing as there are only a few fields that will be forced to remain the same until review (2-3 out of 30 or so fields), what I may do is just:

    - Save changes to a new table
    - Overwrite current table with old data for the 3 fields

    If changes are approved, overwrite the live table with the changes

    So basically, as a workaround, it'll change it and then instantly revert back to old all in same save. Is that ideal? No. But it is better than re-writing a frontend dashboard without metabox which would take significantly longer than this kludge lol

    in reply to: Holding fields for review #39139
    Amy SchmidtAmy Schmidt
    Participant

    Thank you, it has worked well. I do need one more thing, however.

    Could you tell me how to stop the field from actually pushing to database? As I mentioned, I want to hold certain fields for review, so I tapped into 'rwmb_frontend_before_save_post' and have roughly this:

    
    $old = rwmb_get_value($key, '', $id);
    $new = $_POST[$key];
    
    if $old !== $new {
       // Here is where I want to take the field and push it off into it's own custom table but NOT save it to the live site. 
    }
    

    Is there a command to prevent $new from saving if there is a change? Thanks!

    in reply to: Holding fields for review #39019
    Amy SchmidtAmy Schmidt
    Participant

    So, I did the after_save_post action with fields, and just got these fields:

    ` [fields] => Array

            (
                [0] => post_title
                [1] => post_content
                [2] => post_excerpt
                [3] => post_date
            )

    Is there a way to access the actual custom fields on the frontend submission?

    in reply to: Holding fields for review #38941
    Amy SchmidtAmy Schmidt
    Participant

    Hi Peter, thank you. It would have to be the latter because some fields will be allowed to process. I'll check out those hooks ๐Ÿ™‚

    Oh, and the save-to part is fairly important as well. I am using custom tables. When a change is approved, do I just push it to the custom table field, or do I also need to push it to any WordPress tables like wp_postmeta?

    Thanks!

    in reply to: โœ…How is data actually stored? #37442
    Amy SchmidtAmy Schmidt
    Participant

    Okay, I did some testing with ACF/Hookturn Custom Tables and MB and this is what I found (please tell me if correct)

    When a new custom entry is created, here is how it's added:

    ACF/Hookturn - wp_posts, wp_customtable, wp_postmeta
    MB - wp_posts, wp_customtable

    Which is great! That secures MB is far and away better than ACF with Hookturn's custom field add-on. They literally duplicate the data for every entry while Metabox doesn't. So, compliments there!

    Based on that, if I did create the custom frontend, I would indeed have to talk to wp_posts a little - at the very least for the 'post_updated' field. But it also does look like there are enough hooks for mb-frontend to accomplish the things I need. Being able to add classes to the table allow me to design it however I want.

    I am going through an audit of the site right now to see exactly what needs to be done, but I think using mb-frontend may be a good solution. Regardless, I'll be sticking with MB for the rebuild so I'll be bugging you for more support in the future ๐Ÿ™‚

    in reply to: โœ…How is data actually stored? #37435
    Amy SchmidtAmy Schmidt
    Participant

    First question -
    So to clarify, if I have a custom table named: wp_locations and did an INSERT from the frontend, wordpress would recognize it and I can see it on the CPT screen for Locations, delete it, clone it, integrate it with things like admincolumnspro etc?

    Second question -
    Regarding the front end form, I tried using it, but Iโ€™d like a little more customization when it comes to it. Perhaps I can write up a few things I actually do need and post it to the forum to see if there are hooks available?

    Right now the previous dev just hardcoded the stuff right into the plugin code which obviously gets erased on update. So I need to do things like flag fields for review (so admin can approve changes) and other custom features.

    Iโ€™m not looking for custom work done, but if I told you the things needed, could you point me in the right direction with hooks and if it can be done at all (without editing core files)?

    Thank you!

    in reply to: โœ…Google-Maps field won't render in editor view #37308
    Amy SchmidtAmy Schmidt
    Participant

    Has this not been updated yet? It is still not working in the blocks

    in reply to: How to manipulate data after submission? #36920
    Amy SchmidtAmy Schmidt
    Participant

    Thank you. I'll be working on it this week and I'll let you know!

    The person who coded this site before me hardcoded all these changes in the core metabox files so I'm looking to convert them to hooks so they don't disappear every update ๐Ÿ™‚

    Amy SchmidtAmy Schmidt
    Participant

    Ahh, I read that wrong initially.

    After messing with the actual data, it did simply show as an array when I pulled it out which was fine. I am probably going to avoid doing many WP_Query lookups anyway at this point because it's just easier for me to do a wpdb->get than trying to navigate WordPress' WP_Query formula.

    Perhaps I'll watch some WP_Query videos later on to fully understand how that works. I'm sure WP has built-in caching with that (unless I'm wrong?) but it was a nightmare trying to figure it all out.

    Between the serialized data and the issue I had here (https://support.metabox.io/topic/getting-all-data-from-relationship/) it was just quicker to do a LEFT JOIN and pull the fields I needed ๐Ÿ™‚ I know that's not the 'WP proper' way to do it, but definitely easier.

    in reply to: โœ…Getting all data from relationship #35438
    Amy SchmidtAmy Schmidt
    Participant

    Yea you can close this. The helper worked, I must have just been typing something wrong when I first tried.

    in reply to: โœ…Getting all data from relationship #35434
    Amy SchmidtAmy Schmidt
    Participant

    After doing a bunch of reading here, I think this may have the solution I need.

    https://metabox.io/mb-views-how-to-display-relationships/

    I guess the answer is to just use a helper. I thought I tried the php version of it and it didnโ€™t work but Iโ€™ll try again and mess around. Maybe I had a typo

Viewing 12 posts - 1 through 12 (of 12 total)