73 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
Nominata says

Hey Guys,

Working on a new project – its abit like a classified ads, I want a user to come onto the site and post something they have for sale, but I dont want them to have a login, just be able to post there listing with thier contact details.

Can this be done?

Cheers

623 posts
  • Has referred more than 5000 members
  • Has sold $2M+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Had an item featured in a magazine
+9 more
Kriesi says

Yes, thats possible.

just use the

 <?php wp_insert_post( $post ); ?> 

function described here: http://codex.wordpress.org/Function_Reference/wp_insert_post

All you need to do is to build a form anywere in your front-end that the user can access and then upon submitting build the new post out of the data the user submitted…

442 posts
  • Has sold $10,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Has referred 1000+ members
  • Helped several times protecting Envato Market against copyright violations
+4 more
readactor says

a simple way is to use the comment form to do that.

http://justtweetit.com/ is an example.

73 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
Nominata says

Thanks guys :)

Cant wait for Wordpress 3 with the custom post types!

For now I think i am going to do a form and let it create the post – until wordpress 3 comes out.

Cheers for the info :)

2445 posts
  • Has referred 100+ members
  • Has sold $100+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
digitalimpact says

If advanced coding (what Kriesi suggested) sounds hard for you, then you could also use TDO Miniforms for this ;)

73 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
Nominata says
If advanced coding (what Kriesi suggested) sounds hard for you, then you could also use TDO Miniforms for this ;)

Hey good find :) This might be prefect to get my site up quicker – only have a 3 week turn around – Like I said before I am wanting to fully develop my project using WP3 and use the Custom Post Type – it real looks awsome – http://kovshenin.com/archives/custom-post-types-in-wordpress-3-0/?allcomments

Thanks again for the link

557 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Had an item featured in a magazine
  • Made it to the Authors' Hall of Fame
+17 more
theMOLITOR says

OMG , how in the world have I NOT heard of “wp insert post”!!!

Thanks Kriesi!

444 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Located in United Kingdom
TahaH-Studio says

its very simple. Same as what Kriesi said. just make a simple form that will feed into the array. here is a very basic example with a simple form that has no validation.

Edit: I dont know why does it add the SYSTEM word into my doctype. :D

<?php $postTitle = $_POST['post_title'];
$post = $_POST['post'];
$submit = $_POST['submit'];

if(isset($submit)){

    global $user_ID;

    $new_post = array(
        'post_title' ?> $postTitle,
        'post_content' => $post,
        'post_status' => 'publish',
        'post_date' => date('Y-m-d H:i:s'),
        'post_author' => $user_ID,
        'post_type' => 'post',
        'post_category' => array(0)
    );

    wp_insert_post($new_post);

}

?>
<!DOCTYPE HTML SYSTEM>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled Document</title>
</head>

<body>
<div id="wrap">
<form action="" method="post">
<table border="1" width="200">
  <tr>
    <td><label for="post_title">Post Title</label></td>
    <td><input name="post_title" type="text" /></td>
  </tr>
  <tr>
    <td><label for="post">Post</label></td>
    <td><input name="post" type="text" /></td>
  </tr>
</table>

<input name="submit" type="submit" value="submit" />
</form>
</div>

</body>
</html>

1 post
  • Has been part of the Envato Community for over 1 year
  • Has collected 1+ items on Envato Market
matpuscb says

Hello,

how needs the upper code to be modified in order to put more than one field into “post_content”. With some sort of array I think, but I don’t know how to do that. Can someone help me please, thanks

by
by
by
by
by
by