/**
  * Delete one or more entries.
  *
  * @access private
  * @since  0.7.8
  *
  * @uses   Connections_Directory()
  * @uses   wp_parse_id_list()
  * @uses   cnRetrieve::entry()
  * @uses   cnEntry::delete()
  * @uses   do_action()
  *
  * @param  mixed $ids array|int The entry IDs to delete.
  *
  * @return bool
  */
 public static function delete($ids)
 {
     // Grab an instance of the Connections object.
     $instance = Connections_Directory();
     // Make sure $id is not empty.
     if (empty($ids)) {
         return FALSE;
     }
     // Check for and convert to an array.
     $ids = wp_parse_id_list($ids);
     foreach ($ids as $id) {
         $entry = new cnEntry($instance->retrieve->entry($id));
         $entry->delete($id);
         // Delete any meta data associated with the entry.
         self::meta('delete', $id);
     }
     /**
      * Action fired after entries are bulk deleted.
      *
      * @since 8.2.5
      *
      * @param array $ids An array of entry IDs that were deleted.
      */
     do_action('cn_process_bulk_delete', $ids);
     return TRUE;
 }
Esempio n. 2
0
 /**
  * Delete the player.
  *
  * @param none
  * @return void
  */
 public function delete()
 {
     $entry = new cnEntry();
     $entry->delete($this->getId());
 }
Esempio n. 3
0
function processDeleteEntries()
{
	/*
	 * Check whether the current user delete an entry.
	 */
	if (current_user_can('connections_delete_entry'))
	{
		global $connections;
		
		if (empty($_POST['entry'])) return FALSE;
		
		if (current_user_can('connections_delete_entry'))
		{
			$ids = $_POST['entry'];
			
			foreach ($ids as $id)
			{
				$entry = new cnEntry( $connections->retrieve->entry($id) );
				$id = esc_attr($id);
				$entry->delete($id);
				unset($entry);
			}
			
			$connections->setSuccessMessage('form_entry_delete_bulk');
		}
		else
		{
			$connections->setErrorMessage('capability_delete');
		}
	}
	else
	{
		$connections->setErrorMessage('capability_delete');
	}
}