Support

Account

Can ACF do this? (with Social Article)

I have Social Article to allow users to submit posts. In the Social Article, there’re 4 tabs: Published, Under Review, Draft, New Article.

1) When clicking on New Article, is it possible to bring users to ACF frontend form that I prepare in another page, where only login users can post? I don’t
like the default form of Social Article. So, I want to replace it with the form I create with ACF.

2) And there in ACF frontend form in that page, is it possible to have “Save to Draft” button So that when users save to draft, it goes to the Draft tab in Social Article for users to edit later. And is it possible when users click on submit button there in the ACF form page, it goes to the Under Review tab in social Article. (pending for approval)

3) In the Published, Under Review, and Draft tabs, there’s an Edit button. Is it possible when users click on the Edit button, it leads to ACF frontend form where they can edit a post with the ACF form, not the default form.

And If I buy ACF Pro, can you help me with this? Sorry for many questions!

1) You can create an ACF form and then embed this form onto a page and tell the form that it needs to create a new page, post or custom post type. You can also wrap this code into a check to see if the user is logged in so that only logged in users can access this form.

2) You can set the form to always create ‘draft’ posts by default. Or alternatively, you can make it a changeable field and combine it with a hook to actually make the post draft or published. I’ve actually recently done this myself. You would have a field in your ACF form called ‘status’. Then you create a hook that is triggered when this form is submitted. It would get the value of that field, and use it to set the status of the post.

3) The same code that renders the form onto the page from item 1 above, can be used but with a different parameter that edits a post instead of creating a new one.

For example, on your page where you have the form embedded, right at the top you’d have:

/**
* Is something being edited?
* Is the user trying to do this, the author of the post being edited, or an admin?
* If not, redirect back to home
*/
if (isset($_GET['edit'])) {
// get the post being edited
$thispost = get_post($_GET['edit']);
if (USERID == $thispost->post_author || is_administator()) {
$new_post = $_GET['edit'];
} else {
header('Location: '.get_bloginfo('home'));
exit;
}
} else {
$new_post = 'new_post';
}

So if your post create page is website.com/new-post then to edit a post using that same form, you’d have website.com/new-post?edit=23 and then you’d be editing post 23.

Hi, thanks for your information. Glad to hear that’s possible.But it seems to be doable and easy for a person who knows how to do. But for me, I don’t know. I have been through the forum to read information and also checked the documents, still I don’t understand how to do, for example display a form in frontend. Many people just mention about the code, but I did’t know where to put the code, step by step, not mention clearly. So it’s very hard for me to do. If I buy the plugin wothout solving to my request, then I would end up with nothing because it’s very hard for me to use this plugin.

Sorry I did’t indicate clearly about the form for login users. I mean I want only the author who creates a post can edit that post, other authors cannot.

Well when that time comes @topy, create a post here, CC me into the post and I’ll help you through.

That snippet of code I gave in my last post does exactly that – it checks if the current user who’s trying to edit the post, was the author of the post. If so, it’ll let them edit. If not, it’ll redirect to the home page.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.