About this topic

  • Posted by KarlEngstrom 2 years ago. There are 9 posts. The latest reply is from deanhodges.
  1. Hi Byron, great plugin, thanks much for your work!

    I'm planning on using PS in a niche site for kind of a 'traders corner' or 'market place'. The owner of the site want a place each registered user can upload up to 5 photos of items for trade or sale.

    So far I've modded bwbps-layout.php starting line 1770 for the switch and bwbps-admin.php line 657 & 1305 code blocks to add order by user_id. I also enabled manual & custom ordering to find out what I can do with those. I pretty sure using a custom output I can separate the users with a little heading...

    I'm working on the upload limit now but I'm sure that will be more entailed.

    I'll share what I've got if you want but I didn't want to clutter things up here.

    Down side is when I update PS versions I'm sure I'll lose the tweaks.

    Is there another way to do what I'm after or do you think future versions may have some options like this?

    Thanks
    Karl

  2. Hi Karl,

    Glad you're able to use PS for the project! Please send me your modifications and if I can, I'll put them in the code.

    As for the limiting the # of image uploads by user, that should probably be done at the gallery level. If you'll write the code and document it for me, I'll add to the plugin as well.

    To accomplish this, you'd need to extend the galleries table to include a setting for max_images_byuser. 0 would = unlimited and be the default. Database extensions are done in admin/bwbps-init.php

    Then, probably in the bwbps-uploadform.php file somewhere, you'd need to check if gallery['max_images_byuser'] > 0 then how many images does the user have uploaded for tht gallery? If >= gallery['max_images_byuser'] then put a message in the form "You have already uploaded your alloted limit of images to this gallery." Else, get the normal form.

    Then in ajax_upload.php, you should do the check again and bomb out if they've hit the limit.

    I'll be happy to incorporate your code if I can.

    Hope that helps,
    Byron

  3. Good to hear from you Byron-
    My testbed is at http://www.ampsite.com/wp2/, PhotoSmash. I've been tweaking a bunch of other stuff there too, created a custom member list/profile page working around cimy extra. cimy is disabled currently though.
    Anyhow, here's the mods I have so far

    bwbps-layout.php - Line 1770 Sort Order switch. Change this block:
     				switch ( (int)$g['sort_field'] ){
    
    					case 0 :	// When Uploaded
    						$sortby = PSIMAGESTABLE.'.created_date ' . $sorder . ', '.PSIMAGESTABLE.'.seq';
    						break;
    					case 1 :	// Custom Sort
    						$sortby = PSIMAGESTABLE.'.seq, '.PSIMAGESTABLE.'.created_date '. $sorder;
    						break;
    					case 2 :	// Custom Fields
    						$sortby = PSIMAGESTABLE.'.created_date ' . $sorder . ', '.PSIMAGESTABLE.'.seq';
    						break;
    					default :	// When Uploaded
    						$sortby = PSIMAGESTABLE.'.created_date '
    							. $sorder . ', '.PSIMAGESTABLE.'.seq';
    						break;
    
    to this block
     				switch ( (int)$g['sort_field'] ){
    
    					case 0 :	// When Uploaded
    						$sortby = PSIMAGESTABLE.'.created_date ' . $sorder . ', '.PSIMAGESTABLE.'.seq';
    						break;
    					case 1 :	// Custom Sort
    						$sortby = PSIMAGESTABLE.'.seq, '.PSIMAGESTABLE.'.created_date '. $sorder;
    						break;
    					case 2 :	// Custom Fields
    						$sortby = PSIMAGESTABLE.'.created_date ' . $sorder . ', '.PSIMAGESTABLE.'.seq';
    						break;
    					case 3 :	// User IDs
    						$sortby = PSIMAGESTABLE.'.user_id ' . $sorder . ', '.PSIMAGESTABLE.'.seq';
    						break;
    					default :	// When Uploaded
    						$sortby = PSIMAGESTABLE.'.created_date '
    							. $sorder . ', '.PSIMAGESTABLE.'.seq';
    						break;
    ********************************************************************************************************************************************
    
    bwbps-admin.php - Line 657 Form options. Change this block
    					<select name="gal_sort_field">
    						<option value="0" <?php if(!$galOptions['sort_field']) echo 'selected=selected'; ?>>When uploaded</option>
    						<?php /*
    						<option value="1" <?php if($galOptions['sort_field'] == 1) echo 'selected=selected'; ?>>Manual sort</option>
    						<option value="2" <?php if($galOptions['sort_field'] == 2) echo 'selected=selected'; ?>>Custom field</option>
    						*/
    						?>
    					</select>
     to this
     					<select name="gal_sort_field">
    						<option value="0" <?php if(!$galOptions['sort_field']) echo 'selected=selected'; ?>>When uploaded</option>
    						<option value="1" <?php if($galOptions['sort_field'] == 1) echo 'selected=selected'; ?>>Manual sort</option>
    						<option value="2" <?php if($galOptions['sort_field'] == 2) echo 'selected=selected'; ?>>Custom field</option>
                            <option value="3" <?php if($psOptions['sort_field'] == 3) echo 'selected=selected'; ?>>User ID</option>
    					</select>
    
    Line 1305 - Change this block
    					<select name="ps_sort_field">
    						<option value="0" <?php if(!$psOptions['sort_field']) echo 'selected=selected'; ?>>When uploaded</option>
    						<?php /*
    						<option value="1" <?php if($psOptions['sort_field'] == 1) echo 'selected=selected'; ?>>Manual sort</option>
    						<option value="2" <?php if($psOptions['sort_field'] == 2) echo 'selected=selected'; ?>>Custom field</option>
    						*/
    						?>
    					</select>
    
    to this
    					<select name="ps_sort_field">
    						<option value="0" <?php if(!$psOptions['sort_field']) echo 'selected=selected'; ?>>When uploaded</option>
    						<option value="1" <?php if($psOptions['sort_field'] == 1) echo 'selected=selected'; ?>>Manual sort</option>
    						<option value="2" <?php if($psOptions['sort_field'] == 2) echo 'selected=selected'; ?>>Custom field</option>
                            <option value="3" <?php if($psOptions['sort_field'] == 3) echo 'selected=selected'; ?>>User ID</option>
    					</select>
    ***********************************************************************************************************************************************
  4. Karl,
    I have added your code to the next version...0.4.04. It's not in the version I just released, but it'll be in the next one.

    Let me know if you add anything else that might be of general interest to others!

    Thanks,
    Byron

  5. Cool, thanks Byron!
    Currently I'm working through image upload limitations and 'delete/manage your own images'. I've worked out the code for the limits per registered user but don't have it setup as a function as yet. I think I recall seeing some commented out code regarding 'self delete', did you have that going at one time? I'll keep you posted & hit you with any questions.

    Thanks
    Karl

  6. Hi Karl,

    I really appreciate your work on this.

    I'm not sure what your design for the 'delete/manage your own images' is, but here are a couple of thoughts:

    1) It would be good to have a gallery where the user could view their own images...maybe part of the contributor's gallery...and on that gallery the images could have an edit link.
    2) Edit link would pop up a thickbox with a custom form with the fields that the admin wants the user to be able to edit.
    3) Show the image and give jCrop and Rotate capabilities...would ultimately like to use the new WP 2.9 media editing features if that's even possible
    4) Unlike the current Form set up, I'd really like to have it built dynamically through ajax/jQuery...there shouldn't be any need for using jquery.forms.js (which has some conflicts when other plugins are using it also) since there wouldn't be an actual upload of an image. The trick is going to be telling the javascript which fields need to be added to the form since this would include custom fields that could be anything...uggg and I just thought about it...and these custom fields could be all sorts of different fields (checkboxes, dropdowns, etc). Maybe there would be a way to build the fields on the server using the functions in bwbps-uploadform.php. I'm going to add editing of custom fields to the Admin page soon, so I'll be diving into this from that angle...we'll want to make sure we can reuse the functions.

    As a side note, I eventually want to make the main upload forms build on demand by Ajax instead of building them on the server...there are some problems when there are multiple forms on the same page.

    On the question about user deletes, check out ajax_useractions.php. There are functions in there for the delete operation. It has some added security to make sure users are only affecting their own images.

    I look forward to seeing what you come up with!
    Byron

  7. Hi Byron, I've been caught up in another couple of projects, just touching base to let you know I'll be slicing off time to tweak on PS.

    Thanks for all your work!

    Karl

  8. Thanks, Karl!

  9. Hi Karl,

    Any update on the deletion of images or limiting the amount per user? Have you thought about the payment system of it. i.e if you pay $3 you can upload 6 images but pay $9 and its unlimited for example

RSS feed for this topic