Jump to content

Manage Your Attachments


Guest Gypsie

Recommended Posts

Hi,

I currently have the v2.0.3 and have noticed when members are in their
" My Controls" .....In the menu on the left hand side under " Options "
they have " Manage your Attachments ".

I have discovered that if members decide to tidy and delete any of the attachments...
they in fact also get deleted from the messageboard and are left with a blank box.

Perhaps you can have that feature only accesible to Admin team members,and not the standard members,or omit it altogether.

Thanks :)

Link to comment
Share on other sites

Maybe if this was an option for those who don't want to let them, than it would be okay. I like the fact that members can manage their own attachments though. It makes it much easier on me since I'm not constantly getting PM's about how they can free up space so they can post some new things.

Link to comment
Share on other sites

I hear what you are saying...but that's why you can make the allowance as
" Unlimited Global Space Attachments " :)

because as I said...if the members delete anything from their attachments it is also
removed from the website. If several members decide to delete attachments at once...lol...then you would have a rather dead/empty looking forum on your site.

Link to comment
Share on other sites

:( I can't see the point or reason behind having this feature " Manage your Attachments "
again today...another member decided to manage their attachments and delete....as a result
every picture this member posted has now been removed from the board as well,
leaving me with empty threads/posts.

Could you please consider removing this feature in the v2.2 perhaps,
I notice it is still present with the v2.1 :(

Link to comment
Share on other sites

  • 2 weeks later...

I'm glad its there .. I'd hate to see IPS remove that ..

But to help have you thought about seeing of deleting/commenting that section out does anything???

/sources/usercp.php

/*-------------------------------------------------------------------------*/

 	// Attachments

 	/*-------------------------------------------------------------------------*/


 	function attachments()

 	{

		global $ibforums, $DB, $std, $forums;


 		$info	 = array();

 		$start	= intval($ibforums->input['st']);

 		$perpage  = 15;


 		$sort_key = "";


 		switch ($ibforums->input['sort'])

 		{

 			case 'date':

 				$sort_key = 'a.attach_date ASC';

 				$info['date_order'] = 'rdate';

 				$info['size_order'] = 'size';

 				break;

 			case 'rdate':

 				$sort_key = 'a.attach_date DESC';

 				$info['date_order'] = 'date';

 				$info['size_order'] = 'size';

 				break;

 			case 'size':

 				$sort_key = 'a.attach_filesize DESC';

 				$info['date_order'] = 'date';

 				$info['size_order'] = 'rsize';

 				break;

 			case 'rsize':

 				$sort_key = 'a.attach_filesize ASC';

 				$info['date_order'] = 'date';

 				$info['size_order'] = 'size';

 				break;

 			default:

 				$sort_key = 'a.attach_date DESC';

 				$info['date_order'] = 'date';

 				$info['size_order'] = 'size';

 				break;

 		}


 		$this->page_title = $ibforums->lang['m_attach'];

 		$this->nav		= array( "<a href='".$ibforums->base_url."act=UserCP&amp;CODE=00'>".$ibforums->lang['t_title']."</a>" );


 		//-----------------------------------------

 		// Get the ID's to delete

 		//-----------------------------------------


 		$ids = array();


 		foreach ($ibforums->input as $key => $value)

 		{

 			if ( preg_match( "/^attach_(d+)$/", $key, $match ) )

 			{

 				if ($ibforums->input[$match[0]])

 				{

 					$ids[] = $match[1];

 				}

 			}

 		}


 		$affected_ids = count($ids);


 		if ( $affected_ids > 0 )

 		{

 			$DB->cache_add_query( 'usercp_get_to_delete', array( 'mid' => $ibforums->member['id'], 'aid_array' => $ids ) );


			$o = $DB->cache_exec_query();


			while ( $killmeh = $DB->fetch_row( $o ) )

			{

				if ( $killmeh['attach_location'] )

				{

					@unlink( $ibforums->vars['upload_dir']."/".$killmeh['attach_location'] );

				}

				if ( $killmeh['attach_thumb_location'] )

				{

					@unlink( $ibforums->vars['upload_dir']."/".$killmeh['attach_thumb_location'] );

				}


				if ( $killmeh['topic_id'] )

				{

					$DB->simple_construct( array( 'update' => 'topics', 'set' => 'topic_hasattach=topic_hasattach-1', 'where' => 'tid='.$killmeh['topic_id'] ) );

					$DB->simple_shutdown_exec();

				}

			}


			$DB->simple_exec_query( array( 'delete' => 'attachments', 'where' => 'attach_id IN ('.implode(",",$ids).') and attach_member_id='.$ibforums->member['id'] ) );

 		}


 		//-----------------------------------------

 		// Get some stats...

 		//-----------------------------------------


 		$maxspace = intval($ibforums->member['g_attach_max']);


 		if ( $ibforums->member['g_attach_max'] == -1 )

 		{

 			$std->Error( array( 'MSG' => 'no_permission', 'LEVEL' => 1 ) );

 		}


 		//-----------------------------------------

 		// Limit by forums

 		//-----------------------------------------


 		$stats = $DB->simple_exec_query( array( 'select' => 'count(*) as count, sum(attach_filesize) as sum',

 												'from'   => 'attachments',

 												'where'  => 'attach_member_id='.$ibforums->member['id'] ) );


 		if ( $maxspace > 0 )

 		{

			//-----------------------------------------

			// Figure out percentage used

			//-----------------------------------------


			$info['has_limit']	= 1;

			$info['full_percent'] = $stats['sum'] ? sprintf( "%.0f", ( ( $stats['sum'] / ($maxspace * 1024) ) * 100) ) : 0;


			if ( $info['full_percent'] > 100 )

			{

				$info['full_percent'] = 100;

			}


			$info['img_width']	= $info['full_percent'] > 0 ? intval($info['full_percent']) * 2.4 : 1;


			if ($info['img_width'] > 235)

			{

				$info['img_width'] = 235;

			}


			$ibforums->lang['attach_space_count'] = sprintf( $ibforums->lang['attach_space_count'], $stats['count'], $info['full_percent'] );

			$ibforums->lang['attach_space_used']  = sprintf( $ibforums->lang['attach_space_used'] , $std->size_format(intval($stats['sum'])), $std->size_format($maxspace * 1024) );

 		}

 		else

 		{

 			$info['has_limit'] = 0;

 			$ibforums->lang['attach_space_used']  = sprintf( $ibforums->lang['attach_space_unl'] , $std->size_format(intval($stats['sum'])) );

 		}


 		//-----------------------------------------

 		// Pages

 		//-----------------------------------------


 		$pages = $std->build_pagelinks( array( 'TOTAL_POSS'  => $stats['count'],

											   'PER_PAGE'	=> $perpage,

											   'CUR_ST_VAL'  => $start,

											   'L_SINGLE'	=> "",

											   'L_MULTI'	 => $ibforums->lang['msg_pages'],

											   'BASE_URL'	=> $ibforums->base_url."act=usercp&amp;CODE=attach&amp;sort={$ibforums->input['sort']}",

									  )	  );


 		//-----------------------------------------

 		// Get attachments...

 		//-----------------------------------------


 		$DB->cache_add_query( 'usercp_get_attachments', array( 'mid' => $ibforums->member['id'], 'order' => $sort_key, 'limit_a' => $start, 'limit_b' => $perpage ) );


		$DB->cache_exec_query();


		$temp_html = "";


		$ibforums->lang = $std->load_words($ibforums->lang,'lang_topic', $ibforums->lang_id );


		while ( $row = $DB->fetch_row() )

		{

			if ( $std->check_perms($forums->forum_by_id[ $row['forum_id'] ]['read_perms']) != TRUE )

			{

				$row['title'] = $ibforums->lang['attach_topicmoved'];

			}


			//-----------------------------------------

			// Full attachment thingy

			//-----------------------------------------


			if ( $row['attach_pid'] )

			{

				$row['_type'] = 'post';

			}

			else

			{

				$row['_type'] = 'msg';

				$row['title'] = $ibforums->lang['attach_inpm'];

			}


			$row['image']	   = $ibforums->cache['attachtypes'][ $row['attach_ext'] ]['atype_img'];


			$row['short_name']  = $std->txt_truncate( $row['attach_file'], 30 );


			$row['attach_date'] = $std->get_date( $row['attach_date'], 'SHORT' );


			$row['real_size']   = $std->size_format( $row['attach_filesize'] );


			$temp_html .= $this->html->attachments_row( $row );

		}


		$this->output .= $this->html->attachments_top($info, $pages, $temp_html);


 	}

Link to comment
Share on other sites

But to help have you thought about seeing of deleting/commenting that section out does anything???



What exactly would this script do and after reading through your edited code it appears to be the same as the code I currently have in sources/usercp.php
Link to comment
Share on other sites

:huh: What would I comment out ?

Not sure what you mean......can you show me an example of the whole code
similar to the one above? That way I will also know exactly what to write and where.

Thank you :)

Link to comment
Share on other sites

Don't edit that source.

Instead, go to:

AdminCP -> Skin & Templates -> Skin Manager -> (left click on the skin your board is using) -> Edit skin template HTML -> User Control Panel -> Menu_bar
Look for

<if="ipb.member['g_attach_max'] != -1">

<{ITEM_START}> <a href="{$base_url}act=UserCP&amp;CODE=attach">{ipb.lang['m_attach']}</a><br />

</if>

You have a few options.. First you could just delete it all, and that will remove it from EVERYONE'S view, including yours. Second, change that first line to

<if="ipb.member['g_attach_max'] == -2">

which will do the same as the first except that you can just change the line back to restore the feature. Third, change that first line to

<if="ipb.member['g_attach_max'] != -1 and ipb.member['g_is_supmod'] == 1">

and that will require the user to be a SuperMod (or Super Admin) to be able to see the option.

The third option would probably be best as it would allow you to see it and all you would have to do is remove everything after the "!=-1" up to but not including the last quote (") mark to restore it to normal.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...