• Resolved swingjac

    (@swingjac)


    Hi there,

    first of all let me say that your plugin is really a masterpiece. I love all the features. I just got my hands on it and still trying to figure out a lot.

    I ran in to two problems though. First of I’m using a Form to create custom posts from the frontend. Everything is working as expected. But after the post is created the page which holds the form is being duplicated. I’m using Elementor. Don’t know if that causes the problem.

    Furthermore I’m struggling to get an “update post” form working. When I hit the submission, several posts with the same name are being created in the backend with the slugs all over the place.

    Don’t know if I’m doing something wrong here.

    And one last question while I’m typing ;-). Is it possible to get the post authors name in to the email action?

    Any help would be appreciated and thanks again for this wonderful plugin!
    Keep up the good work!

    Cheers

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback. Are you using the latest ACF Extended 0.8.5.5 patch? It’s a bug with Elementor + YOAST which have problems with shortcodes render (creating an infinite loop). Related issue: https://github.com/acf-extended/ACF-Extended/issues/30#issuecomment-612187048

    I posted a bug report in both Elementor & YOAST repo one month ago, but nobody answered. The latest patch added a small bugfix, but maybe that’s an another edge case.

    Post author (unique in WordPress) can be retrieved using Query Var. Please check the ACF Extended Dynamic Forms “Cheatsheet” tab to get the related template tag. You must add an “Action Name” to your Post creation action, so you then can retrieve the related query var.

    Hope it helps!

    Regards.

    Thread Starter swingjac

    (@swingjac)

    Hi,

    thank your for your quick reply. Actually it was my own mistake. I had some acf/save functions sitting in the functions.php. After deleting them every thing is now working flawlessly.

    I will try to get the author-thing working. Thank you for the hint.

    Actually another question came up while working with your great plugin. Is there a way to have bidirectional relationship fields for the same post type? Right now I’m only able to select the bidirection to another post type or am I missing something?

    Thank you again for your help!

    Cheers

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I’m glad to hear that it now works as expected.

    It is possible to setup a bidirectional field within the same post type. But it doesn’t really fit the “Bidirectional” logic. As you have to create 2 different field groups with 2 different fields and link them together.

    In your case, that would mean that you will have to display one field group on some posts, and the second field group on other posts (if you don’t want to have 2 field groups displayed within the same post).

    It looks like you’re looking for is an “inline multi-directional field” which is an another story.

    Have a nice day!

    Regards.

    Thread Starter swingjac

    (@swingjac)

    Hi hwk-fr,

    thank you again for your explanation. That makes sense!

    I’m still struggling to get the post-author name in to the email notification. I added a name to the specific action and used query_var from the cheatsheet but it only returns the ID of the post-author.

    Did anyone get this right and can tell me how the query_var must look like in the email so I see the post-author name?

    Thank you guys!

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Can you please share a screenshot of your configuration, so I can help you? (You can use https://imgur.com)

    Regards.

    Thread Starter swingjac

    (@swingjac)

    Hi there,

    these are the settings I have at the moment.

    View post on imgur.com

    Thank you for your support.

    Cheers

    • This reply was modified 3 years, 12 months ago by swingjac.
    Thread Starter swingjac

    (@swingjac)

    Hi,

    did you have a chance to look at the pics?

    Cheers

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Sorry for the late answer, haven’t seen it before, as the original ticket has been resolved. You should create a new ticket when discussing a new topic, it’s easier for me to keep track of questions.

    For your question, the query_var that is generated by the Post Action is an array version of the WP Post Object (see: https://developer.wordpress.org/reference/functions/get_post/#comment-876).

    As you can see, the post_author key return the author ID (as of in the database). You’ll also see that in the “Cheatsheet” tab in the ACF Extended Form UI. Screenshot: https://i.imgur.com/YboRXXi.png

    If you want to add your own custom key & data inside the query_var returned by the Post Action, you can use the following filter:

    
    add_filter('acfe/form/query_var/post', 'my_acfe_form_post_query_var', 10, 6);
    function my_acfe_form_post_query_var($post_object, $post_id, $post_action, $args, $form, $action){
        
        // Get author infos. See: https://developer.wordpress.org/reference/functions/get_user_by/
        $user = get_user_by('ID', $post_object['post_author']);
        
        // Add our own custom key & data
        $post_object['post_author_name'] = $user->display_name;
        
        // return
        return $post_object;
        
    }
    

    This will add the key post_author_name, so you can use the following template tag in your e-mail: {query_var:add-konzert:post_author_name}.

    Note: I see that you defined a custom post slug, which is identical to the post title. That is not necessary, as WordPress will automatically convert the post title to a slugified version for the slug. You should use it in case you want a different slug.

    For example My Post Title will be automatically converted to my-post-title for the slug. So you can leave it as “Default” 😉

    Have a nice day!

    Regards.

    Thread Starter swingjac

    (@swingjac)

    Hi there,

    thank you so much for your answer. It works now exactly as I wanted it to. This is just great!

    Thank you for your support and keep up the awesome work!

    Have a nice weekend.

    Cheers

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘ACF Form creates Pages after Post creation’ is closed to new replies.