73 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United Kingdom
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

615 posts
  • Power Elite Author
  • Referred more than 2000 users
  • Power Elite Author: Sold between 2 000 000 - 4 999 999 dollars
  • Austria
  • Bought between 100 and 499 items
  • Has been a member for 5-6 years
+4 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…

432 posts
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1000 and 1999 users
  • Europe
  • Sold between 10 000 and 50 000 dollars
  • Envato Studio (Microlancer) Beta Tester
readactor says

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

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

73 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United Kingdom
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 :)

2441 posts
  • Has been a member for 5-6 years
  • Exclusive Author
  • Europe
  • Bought between 10 and 49 items
  • Referred between 100 and 199 users
  • Sold between 100 and 1 000 dollars
  • Envato Studio (Microlancer) Beta Tester
digitalimpact says

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

73 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • United Kingdom
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

555 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Interviewed on the Envato Notes blog
  • Contributed a Blog Post
+12 more
theMOLITOR says

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

Thanks Kriesi!

444 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • 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
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
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