Front-end file upload?

0

Hi guys,

To start off, I'd like to establish that I'm new to WP and even newer to Pods. I'm moving over from drupal. I must say this is quite the plug-in. I just started playing with it the other day and am loving the flexibility.

Now for my question, which will probably fork in to a few more as I develop it:

Is it possible to create a frontend user file upload form in pods? Ideally I'd like to have a simple form where public users (that are logged) can upload .doc/.docx files to a pod. This list would then be viewable / sortable / manageable on the front end (as well as the back-end by the admin of course). I know how to make the list viewable on the front/back end, once the fields are populated, but I have no clue how to make the front-end form to allow users to upload actual files. Would I use publicForm()?

Any help would be much appreciated!

Thanks in advance,

Tre

asked Jan 23 at 3:01

tr3online

1

edited Jan 23 at 3:02

add comment
enter at least 15 characters

3 Answers

0

Yes, publicForm() works exactly as advertised. It creates a form that any member of the public can use to add data to your Pod.

Permission restrictions need to happen on your end though. Here is some code that I use on one of my sites for user validation.

<?php
global $user_ID , $user_level;
get_currentuserinfo();     //Get the information about the current user.
if ($user_ID):                       //Check to see if the user is logged in
 // Get the URL and any query strings used.
 $edit_pod = pods_url_variable('edit', 'get');
 if (0 < strlen($edit_pod)) {
     $pods = new Pod('my_pod', $edit_pod);
  } else {
     $pods = new Pod('my_pod');
  }
 //Generate publicForm here
 else: //User isn't logged in
 ?>
 <h2>Please Login</h2>
 <p>You must <a href='<?php echo wp_login_url();?>'>Log In</a> or <?php wp_register('', ''); ?> to use this form.</p>
 <?php
 endif;

answered Jan 23 at 4:22

chris.pilko

889

edited Jan 23 at 4:27

add comment
enter at least 15 characters
0

Yes you can, but I might not.

To manage who gets to edit their own pod, you can use the Auto Set Current User package on a Pick field in your pod set to relate to the WP_users database. Using this code, you can make sure that only a user that owns a piece of data can edit it. You do need to be careful with this plugin that administrators don't take over the pod when they edit it.

You could very easily create a "Manage my data" screen with a listing of all that user's columns followed by View, Edit and Delete links. The delete link would use a Pod API call.

Rather than allow a stranger delete access to your database, you might just want to add a checkbox field like "Mark for Deletion" on the Edit screen. Once a user checks this you wouldn't display this data anymore to the general public, and an Admin (or a cron job) would then delete it.

answered Jan 23 at 4:37

chris.pilko

889

Ahh, I really like the Mark for Deletion idea. Very tip-top. I'm going to play around with this code for a bit and will probably be back when I run in to many forseeable problems :) – tr3online Jan 23 at 4:41
add comment
enter at least 15 characters
0

Awesome! Thanks for the insight.

Appreciate the fast response,

Tre

answered Jan 23 at 4:27

tr3online

1

edited Jan 23 at 4:38

add comment
enter at least 15 characters