Moderators Kyle Posted June 18, 2011 Moderators Report Posted June 18, 2011 I DO NOT TAKE ANY CREDIT FROM SIMPILOT'S SCREENSHOT MODULE! This is a new function to delete the screenshot. Ok, here's how to add the delete function to simpilot's screenshot. 1) Back up your files!!! 2) Go to core/modules/screenshots/screenshots.php and go to the following line.... if($this->post->action == 'reject_screenshot') { $this->reject_screenshot(); } } And Replace with this... if($this->post->action == 'reject_screenshot') { $this->reject_screenshot(); } if($this->post->action == 'delete_screenshot') { $this->delete_screenshot(); } } 3) Go to the following lines.... protected function reject_screenshot() { $id = DB::escape($this->post->id); ScreenshotsData::reject_screenshot($id); header('Location: '.url('/Screenshots/approval_list')); } Add After the code...... public function delete_screenshot() { ScreenshotsData::delete_screenshot($id); //We need the screenshot id so the function can know which id to delete from the DB header('Location: '.url('/Screenshots/')); //We don't want to show the URL delete link, so it will go to Screenshots $this->set('message', 'Screenshot Deleted!'); //Let them know that the screeshot is deleted. $this->render('core_success.tpl'); //It will show the green bar on top of the page } 4) Go to core/common/ScreenshotsData.class.php and go to the following lines... public function reject_screenshot($id) { $upd = "UPDATE screenshots SET file_approved='2' WHERE id='$id'"; DB::query($upd); } Add After the line............. public function delete_screenshot($id) { $query = "DELETE FROM screenshots WHERE id='$_GET[id]'"; DB::query($query); } 5) Go to screenshots_large.tpl and go to the following lines...... <td align="center"><b>Views:</b> <?php echo $screenshot->views; ?></td> <td> <!-- <form><input class="mail" type="button" value="Back To Gallery" onClick="history.go(-1);return true;"> </form> --> Then add after the lines.... <?php if(PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) { ?><a href="<?php echo SITE_URL ?>/index.php/Screenshots/delete_screenshot?id=<?php echo $screenshot->id; ?>"><b>Delete Screenshot</b></a><?php } else {} ?> THEN! TA-DA. You now have a delete function! Big Thanks to dimitris for helping out to fix the errors! Quote
dimitris Posted June 20, 2011 Report Posted June 20, 2011 Hi all! I took the code a step further to give pilots the ability to delete their own photos At screenshots_large.tpl add the following lines, to allow a pilot to delete his own screenshot. <?php if((PilotData::GetPilotData(Auth::$userinfo->pilotid))==$pilot) { ?> <input onclick="location.href='<?php echo SITE_URL ?>/index.php/Screenshots/delete_screenshot?id=<?php echo $screenshot->id; ?>'" type="button" value="Delete Screenshot" /> <?php } else { } ?> Make sure you have this line at the file. (Standard by simpilot, but who knows ) $pilot = PilotData::getPilotData($screenshot->pilot_id); Between the last 2 { } you can echo a message like: <?php } else { echo "You have no rights to delete this screenshot!"; } ?> Regards, 1 Quote
Moderators Kyle Posted June 20, 2011 Author Moderators Report Posted June 20, 2011 Nice Add dimitris! Quote
Edwin Posted March 6, 2012 Report Posted March 6, 2012 Very nice, was looking for this.. I tried changing the code a bit so it will look the same as the back to gallery button, but it's not working any change you can adjust it a bit make a button similar to the back to gallery button. Quote
Administrators Nabeel Posted March 14, 2012 Administrators Report Posted March 14, 2012 He has this up on github now. The best way is to fork his repository for this; this creates a copy of it under your account. Then you clone it to your computer, make the changes, commit and push. Then those changes are in your repository. After that, you can do a pull request, and Dave can look through the commit and see if it's acceptable, and then the changes will merge into his master copy. 1 Quote
Moderators Kyle Posted March 15, 2012 Author Moderators Report Posted March 15, 2012 I done that, I'll put a pull request and see what Dave thinks. Thanks Nabeel! Quote
Curshad Posted October 25, 2012 Report Posted October 25, 2012 Hey Guys can you help me please this looks realy bad on my website. I want to re align or Resize the Sceenshot Center thing. Seen here " http://skybahamasva.co.cc/index.php/Screenshots " But I am soooo lost on how to do it. I've tried fooling with the /tpl's but no luck. PLease can I get some suggestions? Quote
TAV1702 Posted October 27, 2012 Report Posted October 27, 2012 That was brought up once before in the Obsess Blue thread. Basically, you just find <img src="<?php echo SITE_URL; ?>/pics/<?php echo $screenshot->file_name; ?>" style="max-width: 940px" alt="<?php echo $screenshot->file_description; ?>" /> Change the 940 until you get the size that you want it to be. And this is in the screenshot_large.tpl file. Also, you are going to want to get in to your screenshot_viewer.tpl file and find if ($tiles == '4') { echo '</tr>'; $tiles=0; } } Change the 4 to a 3 and that will take the fourth pic from the right and make it a 3 pic row instead of 4. Then it will all fit nicely on your page. (this is your main gallery index page when you first click to go to the gallery) Also, if you have not done so yet, I recommend fixing the pagination at the bottom of the gallery so it does not list your pages like 1 2 3 Next If you apply the code change, it will show the pagination as 1 2 3 next http://forum.phpvms.net/index.php?app=core&module=search&do=search&fromMainBar=1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.