Website Membership Plugin -- Uploading Image(s)

By yusuke - September 12, 2010

Hi,

I'd like members (using Website Membership Plugin) to upload their profile image(s), and of course display them.

Will you please tell me how to do this?

I am looking for the similar function as this one...

http://www.interactivetools.com/iforum/Products_C2/CMS_Builder%3A_Plugins_%26_Add-ons_F40/gforum.cgi?post=78619;search_string=membership%20upload;t=search_engine#78619

Re: [chris] Website Membership Plugin -- Uploading Image(s)

By yusuke - September 13, 2010

Hi Chris.

This is GREAT! Wow!
Everything is working beautifully.

Thank you so much for your very easy-to-understand instruction, and of course the wonderful code.

I know you would've already done it if it was possible but would it be possible to upload multiple images/user?

Re: [yusuke] Website Membership Plugin -- Uploading Image(s)

By Chris - September 13, 2010 - edited: September 13, 2010

Hi yusuke,

It's certainly possible, just more complicated.

Firstly, you'd want to remove the "remove upload files" block of code above, since that prevents users from uploading more than one image for your field.

Next you'd need to provide a way for users to delete images. The UI is more tricky than actually removing an image. You'd probably want to use JavaScript to fire a request to remove the image without reloading the page (and discarding the user's other changes to the form) and also remove the image element from the page. Another way to do it would be to have checkboxes beside images to delete them.

Once you've decided which image to delete, (preferably based on the upload record's num,) you can delete an upload like this:

function removeUpload($uploadNum) {
$where = mysql_escapef('num = ?', $uploadNum);

// remove upload files
$row = mysql_query_fetch_row_assoc("SELECT * FROM `{$TABLE_PREFIX}uploads` $where");
$files = array($row['filePath'], $row['thumbFilePath'], @$row['thumbFilePath2'], @$row['thumbFilePath3'], @$row['thumbFilePath4']);
foreach ($files as $filepath) {
if (!$filepath || !file_exists($filepath) || @unlink($filepath)) { continue; }

//$error = "Unable to remove file '" .htmlspecialchars($filepath). "'\n\n";
//$error .= "Please ask your server administrator to check permissions on that file and directory.\n\n";
//$error .= "The PHP error message was: $php_errormsg\n";
//die($error);
}

// remove upload record
mysql_query("DELETE FROM `{$TABLE_PREFIX}uploads` $where") or die("MySQL Error: ". htmlspecialchars(mysql_error()) . "\n");
}

All the best,
Chris

Re: [chris] Website Membership Plugin -- Uploading Image(s)

By yusuke - September 13, 2010

Hi Chris,

Thank you so much for your reply!

Even though I understand what you are describing, I have no idea how to implement them, especially the UI part.

How should I move forward on this matter?
If it requires custom programming, will you please let me know so I can ask my client?

Thanx!

Re: [yusuke] Website Membership Plugin -- Uploading Image(s)

By Chris - September 13, 2010

Hi yusuke,

Yes, this is definitely something that our consulting department could help you with. If this is something you're interested in doing, please send an email to consulting@interactivetools.com going over the functionality you would want and we can get you a quote on what this would cost.
All the best,
Chris

Re: [chris] Website Membership Plugin -- Uploading Image(s)

By yusuke - September 13, 2010

Hi Chris,

I will ask my client about it asap.

Thanx!

Re: [Chris] Website Membership Plugin -- Uploading Image(s)

By Thomas - April 10, 2011 - edited: April 10, 2011

Can a modified version of this be used in the signup form?

Re: [Thomas] Website Membership Plugin -- Uploading Image(s)

By Jason - April 11, 2011

Hi,

Yes, you could do this in the signup form. Give it a try and let us know if you run into any issues.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [yusuke] Website Membership Plugin -- Uploading Image(s)

By Maurice - April 12, 2011

This code is great and works wel,

Could you also create a code or plugin with the membership function to upload multiple images and few the current images just like the the back-end of CMSB,

Ithink many people would be happy and great full.

Greetz Maurice
-------------------------------------------

Dropmonkey.nl