Tagged: forms, Front End Forms
- This topic has 18 replies, 4 voices, and was last updated 5 years, 12 months ago by
Steve.
-
AuthorPosts
-
-
November 22, 2013 at 5:53 am #1238
iwillhappy1314MemberPikilist is so awesome, I found it has forms shortcode, but I can`t use in the pages. How can we use it or custom it? is the function under developing?
-
November 22, 2013 at 10:19 am #1239
SteveKeymaster@iwillhappy1314–Frontend forms are still under development, and will be as easy to create as backend forms.
-
November 2, 2015 at 9:07 am #4822
hozefasmileMemberHi Steve,
The application where only backend user can create custom things will only be a limited users thing.
If user from front end are allowed to participate in some app it become more useful as its being used by the whole world.
So till you are developing this feature, is there some way we can use contact form 7 or other front end form creation plugin to integrate with piklist? For example we create a custom post type using piklist and a template to show its custom result in frontend. Now is there a way a user can fillup a form from front end to create new post for such custom post type? Can’t we add the input value that we get from a frontend form be saved in database in a same way your plugin do for backend custom post type form?
Thanks
Hozefa -
November 2, 2015 at 12:37 pm #4828
SteveKeymasterHozefa– Front-end forms are ready to go! Just added some documentation here>
Let me know if you have any questions.
-
November 2, 2015 at 2:12 pm #4830
hozefasmileMember@steve,
Great! going to try it today. I am excited to use it.
Thanks
Hozefa -
November 3, 2015 at 1:33 am #4842
hozefasmileMemberHi @Steve ,
I have added a sample form in frontend from your demo provided, it added successfully a new post in demo post. But what about if we want to edit an existing post? Is there a way to list someone posted post and then edit it in front end same way we create a new post ?Thanks
Hozefa -
November 3, 2015 at 1:34 am #4843
hozefasmileMemberHi @steve ,
Here is a link for your reference http://uniquesweb.co.in/piklist/sample-page/
Thanks
Hozefa -
November 3, 2015 at 12:04 pm #4847
SteveKeymaster@hozefasmile– Is the form set to only show for logged in users? I can’t see it.
-
November 3, 2015 at 12:25 pm #4848
hozefasmileMemberHi Steve,
Sorry, yes it was user logged in enabled, now I have made it public. You can see the form now.
On the page there is currently only a submit button to create a new post under demo post. But what if we want to edit an already submitted post?
-
November 3, 2015 at 12:44 pm #4849
SteveKeymasterTo edit an existing post you just need to pass the Post ID in the url, like this:
http://yourdomain.com/page-with-form/?_post[ID]=1In your case:
http://uniquesweb.co.in/piklist/sample-page/?_post[ID]=1 -
February 10, 2016 at 10:09 am #5888
helmiaditya14Member@Steve, sorry to jump right in, but how to limit only post author is able to edit the form? Right now, anyone with the ID can edit it.
-
February 10, 2016 at 11:23 pm #5900
SteveKeymasterAdd the Capability or Role parameter to the comment block of the form:
Capability: edit_posts -
February 11, 2016 at 6:53 am #5910
helmiaditya14MemberThanks for the response, Steve.
I already tried that with some custom capabilities, but it doesn’t seem to work. Just made a new thread here.
Thanks!
-
February 11, 2016 at 10:33 am #5912
SteveKeymaster@helmiaditya14– We’ll take a look at that and make sure we get it working.
When of the benefits of Piklist is that it’s code-based, so you can use standard WordPress/PHP conditionals if you want:
if( current_user_can('author') ) { // Your form code } else { echo 'You need to be an author to view this form'; } -
February 11, 2016 at 11:07 am #5913
helmiaditya14MemberThanks, Steve.
I already tried the conditional, and as expected, it works fine to prevents other roles to access it. However, users within the same role can still edit each other posts via the form if they put the post id on the edit url.
I was trying to check if current user is the author of the post/form, but how to get the post id inside the form? I tried
get_queried_object_idbut it returns different number. Moreover, is there a way to check if it’s new post or edit post? -
February 11, 2016 at 11:52 am #5914
SteveKeymasterFor a user to edit a form, the url has to look something like this:
http://mydomain.com/my_form/?_post[ID]=84So, you can use the standard PHP $_GET variable to get the ID and then standard WordPress functions to find out who the author is:
if ( isset( $_GET['_post'] ) ) { $post_id = $_GET['_post']['ID']; // Get Post ID $post_author_id = get_post_field( 'post_author', $post_id ); // Get Author ID $user_id = get_current_user_id(); // Get logged in user ID if($user_id == $post_author_id) { // Show form } } -
February 11, 2016 at 12:33 pm #5919
helmiaditya14MemberWonderful! I’m sorry for my lack of basic PHP knowledge, since I was primarily a front-end coder.
Your code example did the trick I’ve been looking for the past couple of days. Piklist definitely worth 10-stars, now I need to catch up with my PHP knowledge so I can use its power properly.
Thank you!
-
February 11, 2016 at 12:38 pm #5921
SteveKeymasterGlad you think Piklist is worth 10 stars…but I’m only going to ask you for 5. 😉
Would you mind leaving a 5 star review on WordPress.org?
-
-
February 11, 2016 at 12:36 pm #5920
SteveKeymasterAwesome! I placed that code snippet in the docs for future reference.
Closing this ticket.
-
-
AuthorPosts
- The topic ‘Can we use forms from frontend?’ is closed to new replies.