Keyword

Advanced Search

Search Results (Searched for: Joomla K2 user extra fields)

  • Michael
  • Michael's Avatar
17 Jul 2012 08:58
[bugreport] content in extra fields was created by Michael

[bugreport] content in extra fields

Category: English K2 Community

Hi,

I set up a list for used vehicles with a list as category view and a detailpage with price, weight and much more. it also contains a contact field, wich i have prefilled with html code for contact data, also activated the wysiwyg editor.

Unfortunately, everytime you hit save the html part will be filtered out.
Is it possible to fix that or include an option to disable it?

I already disabled it in the global joomla settings.
HTML Filter Off for Super-Users.

Otherwise it's a really great extension, i love it.

Oh and yes..
Admin-Templates would be highly appreciated, that we don't have to use this Hack. I think this is a super easy thing for you to integrate.
jurawa.com/notes/item/27-update-2-making-k2-more-like-a-true-cck-custom-admin-templates-and-calling-specific-extra-field-data

For my client, he needs at a specific category only the extra fields and images tab. nothing else.
  • Jerry
  • Jerry's Avatar
12 Jul 2012 08:12 - 12 Jul 2012 08:15
plugin documentation? was created by Jerry

plugin documentation?

Category: English K2 Community

Hi,

It seems I am not going to solve my problems just by using Extra Fields and from what I read I need to write a K2 plugin. I am a php programmer so that is not a problem, but I need some documentation on how to set things up.

I have downloaded the K2 Plugin Example, but some things are still not clear. For example, the class definition. Is this the correct syntax?
class plgK2MyPluginName extends K2Plugin { function plgK2MyPluginName( & $subject, $params) { parent::__construct($subject, $params); } }

Then I see the following functions / triggers:
onK2PrepareContent onK2AfterDisplay onK2BeforeDisplay onK2AfterDisplayTitle onK2BeforeDisplayContent onK2AfterDisplayContent onK2CategoryDisplay onK2UserDisplay

I can't find any trigger names I can use when the user is submitting a front-end form. I need to do stuff like generating a title The item is for an event and contains a date and time and a description that might be empty. I need a generated title so it will give enough information for the admins when they check the list of items.
Also, the Publish Down date should be the event date + 7 days, the category is hidden (set in the menu item to add an event).

I want control of those basic joomla fields and not bother the user with that. I assume that is only possible in an OnSave event function. The plugin description mentions 6 events available for editing. But why can I not find any info on this?

Next, what is the DOM so I can access the item's properties, read extra fields from the database and save them in the item (or just on the screen) before editing its values and reading them back for writing into the database on Save?

Thanks!!
Jerry
  • Jerry
  • Jerry's Avatar
12 Jul 2012 04:43

Editing the front-end form: remove items

Category: English K2 Community

Hi all,

To make things a lot easier for a client, I am simplifying the front-end edit form. For a certain k2 category Events, I have made a menu item New Event, which pops up the New Item window.

The client only has to enter the extra fields: date, time (two dropdown boxes for hours en minutes), a description, and the name of a person (not a user). The only joomla field necessary is Published yes/no.

The item's title should be composed of the selected date plus time plus description.
The item's Publish Down date should be the selected date plus 7 days.

I made a sub template for this category's itemform.php and stripped (commented out) all I didn't need.

Then I got this javascript error:
K2ActiveVideoTab is not defined

When I tried to hide the joomla fields for Publish Up and Publish Down (because I want those in hidden form fields), the calendar gave a popup error it could not do its job.

What is the best way to hide all the tabs except the extra fields (or better: hide all tabs and let me show the fields in my own way) but still have enough data for a joomla and k2 item to be saved and not get errors like the one above?

Thanks!
Jerry
  • iChris
  • iChris's Avatar
06 Jul 2012 17:42 - 06 Jul 2012 18:07
Hello ! K2 Error + blank page was created by iChris

Hello ! K2 Error + blank page

Category: English K2 Community

[SOLVED]

Hello,

Christian, from Belgium. I use K2 for a long time, it is the only good free tool to manage an item. Thank you!

I would contact you because I have a problem with K2.

I develop a Joomla extension that I want the system compatible with K2, because I think your brilliant concept!

Articles must be imported into K2 from an external source.

Currently, the import completes successfully but in FRONTEND, I get this error: "Fatal error: Call to undefined method K2ModelItem :: getUserProfile () in / home/www/fashion/components/com_k2/helpers/utilities.php it line 63 "and a blank page.

I use the class ". ModelItem :: save" slightly modified. (Item entire model is imported into the extension).
In the database, everything seems OK (I compared with native recording) FRONTEND but nothing works.

Could you help me and tell me what I missed please?

Thanking you in advance.

Here k2 modified class I use:

function save($front = false, $toStore)
{

$mainframe = &JFactory::getApplication();
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.archive');
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'class.upload.php');
$db = &JFactory::getDBO();
$user = &JFactory::getUser();
$row = &JTable::getInstance('K2Item', 'Table');
$params = &JComponentHelper::getParams('com_k2');
$nullDate = $db->getNullDate();
define( 'K2_JVERSION', '16' );
$jpath = JPATH_SITE.DS.'components'.DS.'com_k2';
define( 'JPATH_COMPONENT', $jpath );

if (!$row->bind($toStore))
{
$mainframe->redirect('index.php?option=com_k2&view=items', $row->getError(), 'error');
}

if ($front && $row->id == NULL)
{
JLoader::register('K2HelperPermissions', JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'helpers'.DS.'permissions.php');
if (!K2HelperPermissions::canAddItem($row->catid))
{
$mainframe->redirect('index.php?option=com_k2&view=item&task=add&tmpl=component', JText::_('K2_YOU_ARE_NOT_ALLOWED_TO_POST_TO_THIS_CATEGORY_SAVE_FAILED'), 'error');
}
}

($row->id) ? $isNew = false : $isNew = true;

if ($params->get('mergeEditors'))
{
$text = $row->introtext;
if ($params->get('xssFiltering'))
{
$filter = new JFilterInput( array(), array(), 1, 1, 0);
$text = $filter->clean($text);
}
$pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
$tagPos = preg_match($pattern, $text);
if ($tagPos == 0)
{
$row->introtext = $text;
$row->fulltext = '';
}
else
list($row->introtext, $row->fulltext) = preg_split($pattern, $text, 2);
}
else
{
$row->introtext = JRequest::getVar('introtext', '', 'post', 'string', 2);
$row->fulltext = JRequest::getVar('fulltext', '', 'post', 'string', 2);
if ($params->get('xssFiltering'))
{
$filter = new JFilterInput( array(), array(), 1, 1, 0);
$row->introtext = $filter->clean($row->introtext);
$row->fulltext = $filter->clean($row->fulltext);
}
}

if ($row->id)
{
$datenow = &JFactory::getDate();
$row->modified = $datenow->toMySQL();
$row->modified_by = $user->get('id');
}
else
{
$row->ordering = $row->getNextOrder("catid = {$row->catid} AND trash = 0");
if ($row->featured)
$row->featured_ordering = $row->getNextOrder("featured = 1 AND trash = 0", 'featured_ordering');
}

$row->created_by = $row->created_by ? $row->created_by : $user->get('id');

if ($front)
{
$K2Permissions = &K2Permissions::getInstance();
if (!$K2Permissions->permissions->get('editAll'))
{
$row->created_by = $user->get('id');
}
}

if ($row->created && strlen(trim($row->created)) <= 10)
{
$row->created .= ' 00:00:00';
}

$config = &JFactory::getConfig();
$tzoffset = $config->getValue('config.offset');
$date = &JFactory::getDate($row->created, $tzoffset);
$row->created = $date->toMySQL();

if (strlen(trim($row->publish_up)) <= 10)
{
$row->publish_up .= ' 00:00:00';
}

$date = &JFactory::getDate($row->publish_up, $tzoffset);
$row->publish_up = $date->toMySQL();

if (trim($row->publish_down) == JText::_('K2_NEVER') || trim($row->publish_down) == '')
{
$row->publish_down = $nullDate;
}
else
{
if (strlen(trim($row->publish_down)) <= 10)
{
$row->publish_down .= ' 00:00:00';
}
$date = &JFactory::getDate($row->publish_down, $tzoffset);
$row->publish_down = $date->toMySQL();
}

$metadata = JRequest::getVar('meta', null, 'post', 'array');
if (is_array($metadata))
{
$txt = array();
foreach ($metadata as $k => $v)
{
if ($k == 'description')
{
$row->metadesc = $v;
}
elseif ($k == 'keywords')
{
$row->metakey = $v;
}
else
{
$txt[] = "$k=$v";
}
}
$row->metadata = implode("\n", $txt);
}

if (!$row->check())
{
$mainframe->redirect('index.php?option=com_k2&view=item&cid='.$row->id, $row->getError(), 'error');
}

$dispatcher = &JDispatcher::getInstance();
JPluginHelper::importPlugin('k2');
$result = $dispatcher->trigger('onBeforeK2Save', array(&$row, $isNew));
if (in_array(false, $result, true))
{
JError::raiseError(500, $row->getError());
return false;
}

//Trigger the finder before save event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
$results = $dispatcher->trigger('onFinderBeforeSave', array('com_k2.item', $row, $isNew));

// Try to save the video if there is no need to wait for item ID
if (!JRequest::getBool('del_video'))
{
if (!isset($files))
{

if (JRequest::getVar('remoteVideo'))
{
$fileurl = JRequest::getVar('remoteVideo');
$filetype = JFile::getExt($fileurl);
$row->video = '{'.$filetype.'remote}'.$fileurl.'{/'.$filetype.'remote}';
}

if (JRequest::getVar('videoID'))
{
$provider = JRequest::getWord('videoProvider');
$videoID = JRequest::getVar('videoID');
$row->video = '{'.$provider.'}'.$videoID.'{/'.$provider.'}';
}

if (JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW))
{
$row->video = JRequest::getVar('embedVideo', '', 'post', 'string', JREQUEST_ALLOWRAW);
}
}
}

// JoomFish! Front-end editing compatibility
if ($mainframe->isSite() && JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomfish'.DS.'joomfish.php'))
{
if (version_compare(phpversion(), '5.0') < 0)
{
$tmpRow = $row;
}
else
{
$tmpRow = clone($row);
}
}

if (!$row->store())
{
$mainframe->redirect('index.php?option=com_k2&view=items', $row->getError(), 'error');
}

// JoomFish! Front-end editing compatibility
if ($mainframe->isSite() && JFile::exists(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_joomfish'.DS.'joomfish.php'))
{
$itemID = $row->id;
$row = $tmpRow;
$row->id = $itemID;
}

if (!$params->get('disableCompactOrdering'))
{
$row->reorder("catid = {$row->catid} AND trash = 0");
}
if ($row->featured && !$params->get('disableCompactOrdering'))
{
$row->reorder("featured = 1 AND trash = 0", 'featured_ordering');
}
$files = JRequest::get('files');

//Image
if ((int)$params->get('imageMemoryLimit'))
{
ini_set('memory_limit', (int)$params->get('imageMemoryLimit').'M');
}
$existingImage = JRequest::getVar('existingImage');
if (($files === 0 || $existingImage) && !JRequest::getBool('del_image'))
{

if ($files === 0)
{
$image = $files;
}
else
{
$image = JPATH_SITE.DS.JPath::clean($existingImage);
}

$handle = new Upload($image);
$handle->allowed = array('image/*');

if ($handle->uploaded)
{

//Image params
$category = &JTable::getInstance('K2Category', 'Table');
$category->load($row->catid);
$cparams = new JParameter($category->params);

if ($cparams->get('inheritFrom'))
{
$masterCategoryID = $cparams->get('inheritFrom');
$query = "SELECT * FROM #__k2_categories WHERE id=".(int)$masterCategoryID;
$db->setQuery($query, 0, 1);
$masterCategory = $db->loadObject();
$cparams = new JParameter($masterCategory->params);
}

$params->merge($cparams);

//Original image
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'src';
$handle->image_convert = 'jpg';
$handle->jpeg_quality = 100;
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = md5("Image".$row->id);
$handle->Process($savepath);

$filename = $handle->file_dst_name_body;
$savepath = JPATH_SITE.DS.'media'.DS.'k2'.DS.'items'.DS.'cache';

//XLarge image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_XL';
if (JRequest::getInt('itemImageXL'))
{
$imageWidth = JRequest::getInt('itemImageXL');
}
else
{
$imageWidth = $params->get('itemImageXL', '800');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Large image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_L';
if (JRequest::getInt('itemImageL'))
{
$imageWidth = JRequest::getInt('itemImageL');
}
else
{
$imageWidth = $params->get('itemImageL', '600');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Medium image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_M';
if (JRequest::getInt('itemImageM'))
{
$imageWidth = JRequest::getInt('itemImageM');
}
else
{
$imageWidth = $params->get('itemImageM', '400');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Small image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_S';
if (JRequest::getInt('itemImageS'))
{
$imageWidth = JRequest::getInt('itemImageS');
}
else
{
$imageWidth = $params->get('itemImageS', '200');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//XSmall image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_XS';
if (JRequest::getInt('itemImageXS'))
{
$imageWidth = JRequest::getInt('itemImageXS');
}
else
{
$imageWidth = $params->get('itemImageXS', '100');
}
$handle->image_x = $imageWidth;
$handle->Process($savepath);

//Generic image
$handle->image_resize = true;
$handle->image_ratio_y = true;
$handle->image_convert = 'jpg';
$handle->jpeg_quality = $params->get('imagesQuality');
$handle->file_auto_rename = false;
$handle->file_overwrite = true;
$handle->file_new_name_body = $filename.'_Generic';
$imageWidth = $params->get('itemImageGeneric', '300');
$handle->image_x = $imageWidth;
$handle->Process($savepath);

if ($files === 0)
$handle->Clean();

}
else
{
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
}

}

if (JRequest::getBool('del_image'))
{

$current = &JTable::getInstance('K2Item', 'Table');
$current->load($row->id);
$filename = md5("Image".$current->id);

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.$filename.'.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'src'.DS.$filename.'.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XS.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XS.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_S.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_S.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_M.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_M.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_L.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_L.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XL.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_XL.jpg');
}

if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_Generic.jpg'))
{
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'items'.DS.'cache'.DS.$filename.'_Generic.jpg');
}

$row->image_caption = '';
$row->image_credits = '';

}

//Attachments
$attachments = JRequest::getVar('attachment_file', NULL, 'FILES', 'array');
$attachments_names = JRequest::getVar('attachment_name', '', 'POST', 'array');
$attachments_titles = JRequest::getVar('attachment_title', '', 'POST', 'array');
$attachments_title_attributes = JRequest::getVar('attachment_title_attribute', '', 'POST', 'array');
$attachments_existing_files = JRequest::getVar('attachment_existing_file', '', 'POST', 'array');

$attachmentFiles = array();

if (count($attachments))
{

foreach ($attachments as $k => $l)
{
foreach ($l as $i => $v)
{
if (!array_key_exists($i, $attachmentFiles))
$attachmentFiles[$i] = array();
$attachmentFiles[$i][$k] = $v;
}

}

$path = $params->get('attachmentsFolder', NULL);
if (is_null($path))
{
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'attachments';
}
else
{
$savepath = $path;
}

$counter = 0;

foreach ($attachmentFiles as $key => $file)
{

if ($file["tmp_name"] || $attachments_existing_files[$key])
{

$attachmentCleanUpFlag = true;

if ($attachments_existing_files[$key])
{
$file = JPATH_SITE.DS.JPath::clean($attachments_existing_files[$key]);
$attachmentCleanUpFlag = false;
}

$handle = new Upload($file);

if ($handle->uploaded)
{
$handle->file_auto_rename = true;
$handle->allowed[] = 'application/x-zip';
$handle->allowed[] = 'application/download';
$handle->Process($savepath);
$filename = $handle->file_dst_name;
if ($attachmentCleanUpFlag)
{
$handle->Clean();
}

$attachment = &JTable::getInstance('K2Attachment', 'Table');
$attachment->itemID = $row->id;
$attachment->filename = $filename;
$attachment->title = ( empty($attachments_titles[$counter])) ? $filename : $attachments_titles[$counter];
$attachment->titleAttribute = ( empty($attachments_title_attributes[$counter])) ? $filename : $attachments_title_attributes[$counter];
$attachment->store();
}
else
{
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
}
}

$counter++;
}

}

//Gallery
$flickrGallery = JRequest::getVar('flickrGallery');
if ($flickrGallery)
{
$row->gallery = '{gallery}'.$flickrGallery.'{/gallery}';
}

if (isset($files) && $files == 0 && !JRequest::getBool('del_gallery'))
{
$handle = new Upload($files);
$handle->file_auto_rename = true;
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'galleries';
$handle->allowed = array("application/download", "application/rar", "application/x-rar-compressed", "application/arj", "application/gnutar", "application/x-bzip", "application/x-bzip2", "application/x-compressed", "application/x-gzip", "application/x-zip-compressed", "application/zip", "multipart/x-zip", "multipart/x-gzip", "application/x-unknown", "application/x-zip");

if ($handle->uploaded)
{

$handle->Process($savepath);
$handle->Clean();

if (JFolder::exists($savepath.DS.$row->id))
{
JFolder::delete($savepath.DS.$row->id);
}

if (!JArchive::extract($savepath.DS.$handle->file_dst_name, $savepath.DS.$row->id))
{
$mainframe->redirect('index.php?option=com_k2&view=items', JText::_('K2_GALLERY_UPLOAD_ERROR_CANNOT_EXTRACT_ARCHIVE'), 'error');
}
else
{
$row->gallery = '{gallery}'.$row->id.'{/gallery}';
}
JFile::delete($savepath.DS.$handle->file_dst_name);
$handle->Clean();

}
else
{
$mainframe->redirect('index.php?option=com_k2&view=items', $handle->error, 'error');
}
}

if (JRequest::getBool('del_gallery'))
{

$current = &JTable::getInstance('K2Item', 'Table');
$current->load($row->id);

if (JFolder::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'galleries'.DS.$current->id))
{
JFolder::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'galleries'.DS.$current->id);
}
$row->gallery = '';
}

//Video
if (!JRequest::getBool('del_video'))
{
if (isset($files) && $files == 0)
{

$videoExtensions = array("flv", "mp4", "ogv", "webm", "f4v", "m4v", "3gp", "3g2", "mov", "mpeg", "mpg", "avi", "wmv", "divx");
$audioExtensions = array("mp3", "aac", "m4a", "ogg", "wma");
$validExtensions = array_merge($videoExtensions, $audioExtensions);
$filetype = JFile::getExt($files);

if (!in_array($filetype, $validExtensions))
{
$mainframe->redirect('index.php?option=com_k2&view=items', JText::_('K2_INVALID_VIDEO_FILE'), 'error');
}

if (in_array($filetype, $videoExtensions))
{
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'videos';
}
else
{
$savepath = JPATH_ROOT.DS.'media'.DS.'k2'.DS.'audio';
}

$filename = JFile::stripExt($files);

JFile::upload($files, $savepath.DS.$row->id.'.'.$filetype);
$filetype = JFile::getExt($files);
$row->video = '{'.$filetype.'}'.$row->id.'{/'.$filetype.'}';

}

}
else
{

$current = &JTable::getInstance('K2Item', 'Table');
$current->load($row->id);

preg_match_all("#^{(.*?)}(.*?){#", $current->video, $matches, PREG_PATTERN_ORDER);
$videotype = $matches[1][0];
$videofile = $matches[2][0];

if (in_array($videotype, $videoExtensions))
{
if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'videos'.DS.$videofile.'.'.$videotype))
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'videos'.DS.$videofile.'.'.$videotype);
}

if (in_array($videotype, $audioExtensions))
{
if (JFile::exists(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'audio'.DS.$videofile.'.'.$videotype))
JFile::delete(JPATH_ROOT.DS.'media'.DS.'k2'.DS.'audio'.DS.$videofile.'.'.$videotype);
}

$row->video = '';
$row->video_caption = '';
$row->video_credits = '';
}

//Extra fields
$objects = array();
$variables = JRequest::get('post', 4);
foreach ($variables as $key => $value)
{
if (( bool )JString::stristr($key, 'K2ExtraField_'))
{
$object = new JObject;
$object->set('id', JString::substr($key, 13));
$object->set('value', $value);
unset($object->_errors);
$objects[] = $object;
}
}

$csvFiles = JRequest::get('files');
foreach ($csvFiles as $key => $file)
{
if (( bool )JString::stristr($key, 'K2ExtraField_'))
{
$object = new JObject;
$object->set('id', JString::substr($key, 13));
$csvFile = $file[0];
if (!empty($csvFile) && JFile::getExt($file[0]) == 'csv')
{
$handle = @fopen($csvFile, 'r');
$csvData = array();
while (($data = fgetcsv($handle, 1000)) !== FALSE)
{
$csvData[] = $data;
}
fclose($handle);
$object->set('value', $csvData);
}
else
{
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'JSON.php');
$json = new Services_JSON;
$object->set('value', $json->decode(JRequest::getVar('K2CSV_'.$object->id)));
if (JRequest::getBool('K2ResetCSV_'.$object->id))
$object->set('value', null);
}
unset($object->_errors);
$objects[] = $object;
}
}

require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'lib'.DS.'JSON.php');
$json = new Services_JSON;
$row->extra_fields = $json->encode($objects);

require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_k2'.DS.'models'.DS.'extrafield.php');
$extraFieldModel = new K2ModelExtraField;
$row->extra_fields_search = '';

foreach ($objects as $object)
{
$row->extra_fields_search .= $extraFieldModel->getSearchValue($object->id, $object->value);
$row->extra_fields_search .= ' ';
}

//Tags
if ($user->gid < 24 && $params->get('lockTags'))
$params->set('taggingSystem', 0);
$db = &JFactory::getDBO();
$query = "DELETE FROM #__k2_tags_xref WHERE itemID={intval($row->id)}";
$db->setQuery($query);
$db->query();

if ($params->get('taggingSystem'))
{

if ($user->gid < 24 && $params->get('lockTags'))
JError::raiseError(403, JText::_('K2_ALERTNOTAUTH'));

$tags = JRequest::getVar('tags', NULL, 'POST', 'array');
if (count($tags))
{
$tags = array_unique($tags);
foreach ($tags as $tag)
{
$tag = str_replace('-', '', $tag);
$query = "SELECT id FROM #__k2_tags WHERE name=".$db->Quote($tag);
$db->setQuery($query);
$tagID = $db->loadResult();
if ($tagID)
{
$query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($tagID)}, {intval($row->id)})";
$db->setQuery($query);
$db->query();
}
else
{
$K2Tag = &JTable::getInstance('K2Tag', 'Table');
$K2Tag->name = $tag;
$K2Tag->published = 1;
$K2Tag->check();
$K2Tag->store();
$query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($K2Tag->id)}, {intval($row->id)})";
$db->setQuery($query);
$db->query();
}
}
}

}
else
{
$tags = JRequest::getVar('selectedTags', NULL, 'POST', 'array');
if (count($tags))
{
foreach ($tags as $tagID)
{
$query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {intval($tagID)}, {intval($row->id)})";
$db->setQuery($query);
$db->query();
}
}

}

if ($front)
{
if (!K2HelperPermissions::canPublishItem($row->catid) && $row->published)
{
$row->published = 0;
$mainframe->enqueueMessage(JText::_('K2_YOU_DONT_HAVE_THE_PERMISSION_TO_PUBLISH_ITEMS'), 'notice');
}
}

$query = "UPDATE #__k2_items SET
video_caption = ".$db->Quote($row->video_caption).",
video_credits = ".$db->Quote($row->video_credits).", ";

if (!is_null($row->video))
{
$query .= " video = ".$db->Quote($row->video).", ";
}
if (!is_null($row->gallery))
{
$query .= " gallery = ".$db->Quote($row->gallery).", ";
}
$query .= " extra_fields = ".$db->Quote($row->extra_fields).",
extra_fields_search = ".$db->Quote($row->extra_fields_search)." ,
published = ".$db->Quote($row->published)."
WHERE id = ".$row->id;
$db->setQuery($query);

if (!$db->query())
{
$mainframe->redirect('index.php?option=com_k2&view=items', $db->getErrorMsg(), 'error');
}

$row->checkin();

$cache = &JFactory::getCache('com_k2');
$cache->clean();

$dispatcher->trigger('onAfterK2Save', array(&$row, $isNew));
if (K2_JVERSION == '16')
{
$dispatcher->trigger('onContentAfterSave', array(&$row, $isNew));
}
else
{
$dispatcher->trigger('onAfterContentSave', array(&$row, $isNew));
}

//Trigger the finder after save event
$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('finder');
$results = $dispatcher->trigger('onFinderAfterSave', array('com_k2.item', $row, $isNew));

switch (JRequest::getCmd('task'))
{
case 'apply' :
$msg = JText::_('K2_CHANGES_TO_ITEM_SAVED');
$link = 'index.php?option=com_k2&view=item&cid='.$row->id;
break;
case 'saveAndNew' :
$msg = JText::_('K2_ITEM_SAVED');
$link = 'index.php?option=com_k2&view=item';
break;
case 'save' :
default :
$msg = JText::_('K2_ITEM_SAVED');
if ($front)
$link = 'index.php?option=com_k2&view=item&task=edit&cid='.$row->id.'&tmpl=component&Itemid='.JRequest::getInt('Itemid');
else
$link = 'index.php?option=com_k2&view=items';
break;
}
return $row->id;
}

  • Harald Moun
  • Harald Moun's Avatar
28 Jun 2012 01:53
Filtering extra fields on frontend was created by Harald Moun

Filtering extra fields on frontend

Category: English K2 Community

hi all!

I want to create a catalog of hotels. Some information like "Dogs allowed" or "Bikes for free use" I want to store using extra-fields. Is there a possibility to create on the frontend a filter where the user can select the things he is looking for so that joomla/k2 then creates a list of according hotels?

thx
harald
  • hyp3rkyd
  • hyp3rkyd's Avatar
07 Jun 2012 07:29
Questions on membership was created by hyp3rkyd

Questions on membership

Category: English K2 Community

Hi all,

I am creating a new website and although I have an intermediate knowledge in joomla and k2, I have never used anything for memberships. My website offers directory listing for a specific type of businesses and I want to charge for three packages : Free/basic, Silver, Gold (or something like that). For every business I have created a new K2 Item and for every piece of data (address, kind of service, phone number etc.) I have created an extra field. What I want to do is:

1. the user selects a package and pays (paypal is fine)
2. he gets permission to edit specific fields for a specific item (his business k2 item)
3. If he pays for package X, he gets permissions to edit A, B, D fields. If he pays for package Y, he gets permission to edit C, E etc.
4. Guest users have no access to specific k2 extra fields until they register (free).

What I search for is any route that would lead me to find the solution. The easy way would be to find a nice membership extension that would cooperate with K2 smoothly and easily. Have you done or used anything like this before?

regards
C
  • Red Deer
  • Red Deer's Avatar
25 Apr 2012 00:30

Blank User Groups, Extra Fields, Extra Groups

Category: English K2 Community

Hi,

What would prevent the K2 User Groups, Extra Fields, and Extra Field Groups pages from loading properly?

Details:

  • Using demo content from JoomlaBamboo Rasa template (new installation)
  • Using LDAP to authenticate (maybe a red herring)

I get a blank screen when I access User Groups, Extra Fields, or Extra Field Groups from the Joomla 2.5 back end. No error message, even with Joomla debugging display enabled. All Super User parameter permissions are enabled.

The following K2 selections are accessible:

  • Items
  • Categories (works fine -- I added some categories)
  • Tags
  • Comments
  • Users (users from Joomla groups show up fine; no K2 users are listed if either registered or Site Owner is selected from the -- Select joomla! Group-- pull-down menu)
  • Media Manager
  • Information (all installed and writable)


The following K2 selections cause a blank page (not even an error) to be displayed:
  • User Groups
  • Extra Fields
  • Extra Field Groups


Thanks!
  • Ed Deyzel
  • Ed Deyzel's Avatar
24 Apr 2012 11:00 - 24 Apr 2012 11:01
Validating image and attachments fields. was created by Ed Deyzel

Validating image and attachments fields.

Category: English K2 Community

Hi,

I'm trying to validate the Image and Attachment fields to make sure the user has selected the respected items before saving from the frontend.

I'm using the
 
  • Justin Thomas
  • Justin Thomas's Avatar
08 Apr 2012 10:18

Extra fields won't show in the front end using JCE

Category: English K2 Community

I am running the following in my localhost environment:
J! 2.5.4
K2 2.5.6
JCE 2.0.21

I am launching the K2 Add New Item lightbox from K2 User module. This module is sitting in a Qlue Panel . The link opens up the lightbox, JCE editor works with the parameters I have set for the user level.

The user is set to:
Author in Joomla
K2 Front-End Editing, Add items, Edit Own Items, Publish Items

When I try to select the category "Workshops" (the only category) to load the extra fields I get the following error message:



In the back-end this is working fine.

To cut this short I will now list my <head> scripts
 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools-yui-compressed.js"></script> <script src="/rainbows25/media/system/js/core.js" type="text/javascript"></script> <script src="/rainbows25/media/system/js/mootools-more.js" type="text/javascript"></script> <script src="/rainbows25/media/system/js/modal.js" type="text/javascript"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script> <script src="/rainbows25/components/com_k2/js/k2.js" type="text/javascript"></script> <script src="/rainbows25/plugins/system/rokbox/rokbox.js" type="text/javascript"></script> <script src="/rainbows25/plugins/system/rokbox/themes/light/rokbox-config.js" type="text/javascript"></script> <script src="http://localhost/rainbows25//modules/mod_cassrina_hover_image_menu/script_cassrina.js" type="text/javascript"></script> <script type="text/javascript"> window.addEvent('domready', function() { SqueezeBox.initialize({}); SqueezeBox.assign($$('a.modal'), { parse: 'rel' }); }); var K2SitePath = '/rainbows25/'; var rokboxPath = '/rainbows25/plugins/system/rokbox/'; img142=new Image();img142.src="http://localhost/rainbows25/images/stories/tuition.png";img_roll142=new Image();img_roll142.src="http://localhost/rainbows25/images/stories/tuition_roll.png";img143=new Image();img143.src="http://localhost/rainbows25/images/stories/workshops.png";img_roll143=new Image();img_roll143.src="http://localhost/rainbows25/images/stories/workshops_roll.png";img144=new Image();img144.src="http://localhost/rainbows25/images/stories/readings.png";img_roll144=new Image();img_roll144.src="http://localhost/rainbows25/images/stories/readings_roll.png";img145=new Image();img145.src="http://localhost/rainbows25/images/stories/retreats.png";img_roll145=new Image();img_roll145.src="http://localhost/rainbows25/images/stories/retreats_roll.png";img146=new Image();img146.src="http://localhost/rainbows25/images/stories/contactme.png";img_roll146=new Image();img_roll146.src="http://localhost/rainbows25/images/stories/contactme_roll.png";img147=new Image();img147.src="http://localhost/rainbows25/images/stories/healing.png";img_roll147=new Image();img_roll147.src="http://localhost/rainbows25/images/stories/healing_roll.png";img148=new Image();img148.src="http://localhost/rainbows25/images/stories/meditation.png";img_roll148=new Image();img_roll148.src="http://localhost/rainbows25/images/stories/meditation_roll.png"; </script>

Just in case it is a jquery conflict.

Over to you guys. I'm pretty sure somebody will recognise this error, though I have searched long and hard for this one.
  • Jan Franciszek Cieslak
  • Jan Franciszek Cieslak's Avatar
06 Apr 2012 00:59
I need extra fields in the user profiles was created by Jan Franciszek Cieslak

I need extra fields in the user profiles

Category: English K2 Community

Hi all,
This is my first post on this forum. Here is my question. I am using joomla 2.5. I would like to add some extra custom fields in user profile pages, not in articles), which can be edited by the users themselves. BUT, these fields should only exist in profiles form specific ACL groups. I know that K2 extension offers a possibility of adding extra fields in articles, but can you add them in user profile pages too?
Overall, this is what I am trying to achieve for the website I am making:
There will be 2 types of users with a possibility of adding content: lets say registered users, and premium users.
Premium accounts will be paid (could be done with a subscription extension), but unlike in normal paid subscription account, they will not have access to additional content, but instead, they will be able to create an extended profile page (lets say with description and images instead of just contact details). So I just wanted to know which extension would give me this possibility of adding extra fields to profile pages, based on ACL. Would K2 do the job?
BIG THANKS!
  • Lars
  • Lars's Avatar
10 Mar 2012 16:26

3 Question i couldnt find in the forum

Category: English K2 Community

hi..
soo... my questions are.. can i add a contact form to every user profile? is there a posibility to show a list of all users? how can i add custom fields or how can id edit the plugin for extra fields?

iam using joomla 2.5 und latest version of k2

thx a lot
  • Tom Groehlich
  • Tom Groehlich's Avatar
07 Mar 2012 23:40 - 09 Mar 2012 20:43
SOLVED: Error: Picasa Slideshows in K2 Artikel was created by Tom Groehlich

SOLVED: Error: Picasa Slideshows in K2 Artikel

Category: Offizielle deutsche Gemeinschaft

Hey folks,
Ich versuche ein Picasa Album über deren Flashplayer in einen Artikel einzubinden. Mit Joomla Content (Artikeln) klappt das, bei K2 bekomme ich beim Speichern einen Fehler:
Notice: Undefined property: TableK2Item::$extra_fields_Search in /var/www/web309/html/JOM_TW_TEST/administrator/components/com_k2/models/item.php on line 678 Fatal error: Class 'JSite' not found in /var/www/web309/html/JOM_TW_TEST/plugins/content/phocagallery/phocagallery.php on line 55

Der einzubindenen HTML Code ist:
<object type="application/x-shockwave-flash" width="288" height="192" flashvars="host=picasaweb.google.com&amp;hl=en_US&amp;feat=flashalbum&amp;RGB=0x000000&amp;feed=https://picasaweb.google.com/data/feed/api/user/100580395361527982304/albumid/5716196751877629249?alt=rss&amp;kind=photo&amp;authkey=Gv1sRgCIna9ZXmwJGhkAE&amp;hl=en_US" pluginspage="http://www.macromedia.com/go/getflashplayer" data="https://picasaweb.google.com/s/c/bin/slideshow.swf"> <param name="movie" value="https://picasaweb.google.com/s/c/bin/slideshow.swf" /> </object>

LÖSUNG: Ich hatte auf der Seite eine ältere Version des Phoca Gallery Plugins. nach Inst der neusten version hats wieder gefunzt.Scheint also nicht an K2 gelegen zu haben

tom
  • Henrik Nielsen
  • Henrik Nielsen's Avatar
28 Feb 2012 09:27

User Extended Fields for K2 [Bug and no response]

Category: English K2 Community

Hi

I think that the "User Extended Fields for K2" is great! My only problem is that its not working 100%.
I see PLG_K2_UEF_CONTACT_DETAILS both in frontend and backend.

This blog is closed even though a lot of people has the same problem:
community.getk2.org/profiles/blogs/user-extended-fields-for-k2-1
Download here is version 1.0 of "User Extended Fields for K2".

In this blog there is a referance to this site:
getk2.org/extend/extensions/date/item/73-user-extended-fields-for-k2
Download here is version 2.0 of "User Extended Fields for K2"

At this blog I'm unable to leave a comment. It keeps asking me to fill out all required fields, even though I have done that! :-(

IS THIS PLUGIN OUTDATED?!?!?

Is there an other way to do extra fields on a User Page i K2 today?
Am I missing something here?

I use J1.7 and K2 2.5

Othere than the language problem not loading the text-strings it works perfect.

If I don't get an answer soon I will try to correct the code myself. But I think the support is poor :-(
A lot of people is writting about this, but no response from K2 og JoomlaWorks.

Best regards,
Henrik

  • Aaron
  • Aaron's Avatar
27 Feb 2012 21:12
Looking for a good user component was created by Aaron

Looking for a good user component

Category: English K2 Community

I haven't seen whether or not K2 has an adjustable user login component in that I want to allow me to add extra fields to the registration process.

If K2 cannot do this, does anyone have experience with adding fields or can recommend a good component? I had thought about Jomsocial but not sure I need all of that to add a few extra fields. I also own licensing to mighty extensions but they do not plan on being compatible with the current version of Joomla (2.5) until after Joomla 3 is released this summer.

Thanks in advance!
  • Uldis
  • Uldis's Avatar
25 Feb 2012 15:34 - 25 Feb 2012 15:35

Please help me figure out how to make this layout

Category: English K2 Community

I added first piece of code on line 21 and second on line 164.
<?php /** * @version $Id: category_item.php 1251 2011-10-19 17:50:13Z joomlaworks $ * @package K2 * @author JoomlaWorks http://www.joomlaworks.gr * @copyright Copyright (c) 2006 - 2011 JoomlaWorks Ltd. All rights reserved. * @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html */ // no direct access defined('_JEXEC') or die('Restricted access'); // Define default image size (do not change) K2HelperUtilities::setDefaultImage($this->item, 'itemlist', $this->params); ?> <!-- Start K2 Item Layout --> <div class="catItemView group<?php echo ucfirst($this->item->itemGroup); ?><?php echo ($this->item->featured) ? ' catItemIsFeatured' : ''; ?><?php if($this->item->params->get('pageclass_sfx')) echo ' '.$this->item->params->get('pageclass_sfx'); ?>"> <!-- Call to prepare extra field IDs --> <?php //convertArray to use ids as key $extrafieldsid = array(); foreach($this->item->extra_fields as $itemid) { $extrafieldsid[$itemid->id] = $itemid->value; } ?> <!-- Call to prepare extra field labels --> <?php //convertArray to use labels as key $extrafieldslabels = array(); foreach($this->item->extra_fields as $itemlabel) { $extrafieldslabels[$itemlabel->id] = $itemlabel->name; } ?> <!-- Plugins: BeforeDisplay --> <?php echo $this->item->event->BeforeDisplay; ?> <!-- K2 Plugins: K2BeforeDisplay --> <?php echo $this->item->event->K2BeforeDisplay; ?> <div class="catItemHeader"> <?php if($this->item->params->get('catItemDateCreated')): ?> <!-- Date created --> <span class="catItemDateCreated"> <?php echo JHTML::_('date', $this->item->created , JText::_('K2_DATE_FORMAT_LC2')); ?> </span> <?php endif; ?> <?php if($this->item->params->get('catItemTitle')): ?> <!-- Item title --> <h3 class="catItemTitle"> <?php if(isset($this->item->editLink)): ?> <!-- Item edit link --> <span class="catItemEditLink"> <a class="modal" rel="{handler:'iframe',size:{x:990,y:550}}" href="<?php echo $this->item->editLink; ?>"> <?php echo JText::_('K2_EDIT_ITEM'); ?> </a> </span> <?php endif; ?> <?php if ($this->item->params->get('catItemTitleLinked')): ?> <a href="<?php echo $this->item->link; ?>"> <?php echo $this->item->title; ?> </a> <?php else: ?> <?php echo $this->item->title; ?> <?php endif; ?> <?php if($this->item->params->get('catItemFeaturedNotice') && $this->item->featured): ?> <!-- Featured flag --> <span> <sup> <?php echo JText::_('K2_FEATURED'); ?> </sup> </span> <?php endif; ?> </h3> <?php endif; ?> <?php if($this->item->params->get('catItemAuthor')): ?> <!-- Item Author --> <span class="catItemAuthor"> <?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?> <a rel="author" href="<?php echo $this->item->author->link; ?>"><?php echo $this->item->author->name; ?></a> </span> <?php endif; ?> </div> <!-- Plugins: AfterDisplayTitle --> <?php echo $this->item->event->AfterDisplayTitle; ?> <!-- K2 Plugins: K2AfterDisplayTitle --> <?php echo $this->item->event->K2AfterDisplayTitle; ?> <?php if($this->item->params->get('catItemRating')): ?> <!-- Item Rating --> <div class="catItemRatingBlock"> <span><?php echo JText::_('K2_RATE_THIS_ITEM'); ?></span> <div class="itemRatingForm"> <ul class="itemRatingList"> <li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li> <li><a href="#" rel="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li> </ul> <div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div> <div class="clr"></div> </div> <div class="clr"></div> </div> <?php endif; ?> <div class="catItemBody"> <!-- Plugins: BeforeDisplayContent --> <?php echo $this->item->event->BeforeDisplayContent; ?> <!-- K2 Plugins: K2BeforeDisplayContent --> <?php echo $this->item->event->K2BeforeDisplayContent; ?> <?php if($this->item->params->get('catItemImage') && !empty($this->item->image)): ?> <!-- Item Image --> <div class="catItemImageBlock"> <span class="catItemImage"> <a href="<?php echo $this->item->link; ?>" title="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>"> <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" style="width:<?php echo $this->item->imageWidth; ?>px; height:auto;" /> </a> </span> <div class="clr"></div> </div> <?php endif; ?> <?php if($this->item->params->get('catItemIntroText')): ?> <!-- Item introtext --> <div class="catItemIntroText"> <?php echo $this->item->introtext; ?> </div> <?php endif; ?> <?php if($this->item->params->get('catItemExtraFields') && count($this->item->extra_fields)): ?> <!-- Item extra fields --> <div class="catItemExtraFields"> <h4><?php echo JText::_('K2_ADDITIONAL_INFO'); ?></h4> <ul> <?php foreach ($this->item->extra_fields as $key=>$extraField): ?> <?php if($extraField->value): ?> <li class="<?php echo ($key%2) ? "odd" : "even"; ?> type<?php echo ucfirst($extraField->type); ?> group<?php echo $extraField->group; ?>"> <span class="catItemExtraFieldsLabel"><?php echo $extraField->name; ?></span> <span class="catItemExtraFieldsValue"><?php echo $extraField->value; ?></span> </li> <?php endif; ?> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?> <!-- Extra Fields --> <div class="extrafield"> <strong><?php echo $extrafieldslabels[1];?>: </strong><?php echo $extrafieldsid[1];?> </div> <div class="extrafield"> <strong><?php echo $extrafieldslabels[2];?>: </strong><?php echo $extrafieldsid[2];?> </div> <div class="clr"></div> <!-- End Extra Fields --> <!-- Plugins: AfterDisplayContent --> <?php echo $this->item->event->AfterDisplayContent; ?> <!-- K2 Plugins: K2AfterDisplayContent --> <?php echo $this->item->event->K2AfterDisplayContent; ?> <div class="clr"></div> </div> <?php if( $this->item->params->get('catItemHits') || $this->item->params->get('catItemCategory') || $this->item->params->get('catItemTags') || $this->item->params->get('catItemAttachments') ): ?> <div class="catItemLinks"> <?php if($this->item->params->get('catItemHits')): ?> <!-- Item Hits --> <div class="catItemHitsBlock"> <span class="catItemHits"> <?php echo JText::_('K2_READ'); ?> <b><?php echo $this->item->hits; ?></b> <?php echo JText::_('K2_TIMES'); ?> </span> </div> <?php endif; ?> <?php if($this->item->params->get('catItemCategory')): ?> <!-- Item category name --> <div class="catItemCategory"> <span><?php echo JText::_('K2_PUBLISHED_IN'); ?></span> <a href="<?php echo $this->item->category->link; ?>"><?php echo $this->item->category->name; ?></a> </div> <?php endif; ?> <?php if($this->item->params->get('catItemTags') && count($this->item->tags)): ?> <!-- Item tags --> <div class="catItemTagsBlock"> <span><?php echo JText::_('K2_TAGGED_UNDER'); ?></span> <ul class="catItemTags"> <?php foreach ($this->item->tags as $tag): ?> <li><a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?></a></li> <?php endforeach; ?> </ul> <div class="clr"></div> </div> <?php endif; ?> <?php if($this->item->params->get('catItemAttachments') && count($this->item->attachments)): ?> <!-- Item attachments --> <div class="catItemAttachmentsBlock"> <span><?php echo JText::_('K2_DOWNLOAD_ATTACHMENTS'); ?></span> <ul class="catItemAttachments"> <?php foreach ($this->item->attachments as $attachment): ?> <li> <a title="<?php echo K2HelperUtilities::cleanHtml($attachment->titleAttribute); ?>" href="<?php echo $attachment->link; ?>"> <?php echo $attachment->title ; ?> </a> <?php if($this->item->params->get('catItemAttachmentsCounter')): ?> <span>(<?php echo $attachment->hits; ?> <?php echo ($attachment->hits==1) ? JText::_('K2_DOWNLOAD') : JText::_('K2_DOWNLOADS'); ?>)</span> <?php endif; ?> </li> <?php endforeach; ?> </ul> </div> <?php endif; ?> <div class="clr"></div> </div> <?php endif; ?> <div class="clr"></div> <?php if($this->item->params->get('catItemVideo') && !empty($this->item->video)): ?> <!-- Item video --> <div class="catItemVideoBlock"> <h3><?php echo JText::_('K2_RELATED_VIDEO'); ?></h3> <?php if($this->item->videoType=='embedded'): ?> <div class="catItemVideoEmbedded"> <?php echo $this->item->video; ?> </div> <?php else: ?> <span class="catItemVideo"><?php echo $this->item->video; ?></span> <?php endif; ?> </div> <?php endif; ?> <?php if($this->item->params->get('catItemImageGallery') && !empty($this->item->gallery)): ?> <!-- Item image gallery --> <div class="catItemImageGallery"> <h4><?php echo JText::_('K2_IMAGE_GALLERY'); ?></h4> <?php echo $this->item->gallery; ?> </div> <?php endif; ?> <div class="clr"></div> <?php if($this->item->params->get('catItemCommentsAnchor') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?> <!-- Anchor link to comments below --> <div class="catItemCommentsLink"> <?php if(!empty($this->item->event->K2CommentsCounter)): ?> <!-- K2 Plugins: K2CommentsCounter --> <?php echo $this->item->event->K2CommentsCounter; ?> <?php else: ?> <?php if($this->item->numOfComments > 0): ?> <a href="<?php echo $this->item->link; ?>#itemCommentsAnchor"> <?php echo $this->item->numOfComments; ?> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?> </a> <?php else: ?> <a href="<?php echo $this->item->link; ?>#itemCommentsAnchor"> <?php echo JText::_('K2_BE_THE_FIRST_TO_COMMENT'); ?> </a> <?php endif; ?> <?php endif; ?> </div> <?php endif; ?> <?php if ($this->item->params->get('catItemReadMore')): ?> <!-- Item "read more..." link --> <div class="catItemReadMore"> <a class="k2ReadMore" href="<?php echo $this->item->link; ?>"> <?php echo JText::_('K2_READ_MORE'); ?> </a> </div> <?php endif; ?> <div class="clr"></div> <?php if($this->item->params->get('catItemDateModified')): ?> <!-- Item date modified --> <?php if($this->item->modified != $this->nullDate && $this->item->modified != $this->item->created ): ?> <span class="catItemDateModified"> <?php echo JText::_('K2_LAST_MODIFIED_ON'); ?> <?php echo JHTML::_('date', $this->item->modified, JText::_('K2_DATE_FORMAT_LC2')); ?> </span> <?php endif; ?> <?php endif; ?> <!-- Plugins: AfterDisplay --> <?php echo $this->item->event->AfterDisplay; ?> <!-- K2 Plugins: K2AfterDisplay --> <?php echo $this->item->event->K2AfterDisplay; ?> <div class="clr"></div> </div> <!-- End K2 Item Layout --> 
  • Kannan Naidu Venugopal
  • Kannan Naidu Venugopal's Avatar
12 Jan 2012 14:58
Replied by Kannan Naidu Venugopal on topic Joomla 1.7 Multi Language in Extra Fields?

Joomla 1.7 Multi Language in Extra Fields?

Category: English K2 Community

Hi,

It will be the same as you create your content. You don't expect Joomla or K2 to translate the English language to French or German automatically!! You have to manually install a language file and translate the content. Eg: You have a default language in english for all the item and you create another language for the same items. The same will apply to extra field titles.

The extra field title is user typed input and not from the component.
  • Jason Chen
  • Jason Chen's Avatar
10 Jan 2012 03:10
Dynamic use of Extra Fields was created by Jason Chen

Dynamic use of Extra Fields

Category: English K2 Community

Hi,

I'm new to Joomla and K2 and I think both are great! However, I have a question on how to properly use extra fields. I find there aren't enough practically examples out there, so hopefully, someone can help.

In particular, I am trying to read from / write to extra fields using php. Essentially, what I want to do is have an extra field called "Location". When a user creates a new item, I want to find a user's location (using some yet to be determined php code) and pre-populate the extra-field with it.

I have 2 questions. First, am I editing the right file? I'm working in itemform.php.
Secondly, I'm looking at the code:

<?php foreach($this->extraFields as $extraField): ?>
<tr>
<td align="right" class="key">
<?php echo $extraField->name; ?>
</td>
<td>
<?php echo $extraField->element; ?>
</td>
</tr>
<?php endforeach; ?>

and it appears to be just display code? So how do I go about writing code that can dynamically place data into the field?

Thanks in advance!
  • Falko
  • Falko's Avatar
07 Jan 2012 23:52 - 08 Jan 2012 23:11
Create items by forms in frontend was created by Falko

Create items by forms in frontend

Category: English K2 Community

I would like to create a k2 page, where registered users can create items in the frontend using forms similar to Contentbuilder and them be filtered by Multiple Extra Fields Filter and Search Module or similar.
Actually Autos is a good example, it lacks only the possibility to insert information by forms.
Is there a way to link k2 items with wiki? Wiki.link

Thanks
  • Falko
  • Falko's Avatar
07 Jan 2012 09:45 - 07 Jan 2012 10:29

K2 Beiträge von Usern im Frontend per formular

Category: Offizielle deutsche Gemeinschaft

Hallo,

Bin neu in K2 aber total begeistert, ich würde gern eine Seite mit k2 erstellen, wo Benutzer, die weder Ahnung von joomla noch K2 haben, ähnlich wie beim Contentbuilder Informationen im frontend in mehrere Felder eingeben und diese dann mit Multiple Extra Fields Filter and Search Module oder ähnliches gefiltert anzeigen können.
Das mit den Autos ist ein gutes Beispiel, nur müssten registrierte Benutzer die Informationen inklusive Bild eingeben können.
Gibt es eine moglichkeit k2 Beiträge mit Wiki zu verlinken? Wiki.link

Hat hier jemand eine Idee?

I would like to create a k2 page, where registered users can create items in the frontend using forms similar to Contentbuilder and them be filtered by Multiple Extra Fields Filter and Search Module or similar.
Actually Autos is a good example, it lacks only the possibility to insert information by forms.
Is there a way to link k2 items with wiki? Wiki.link


Vielen dank.

Falko
  • Jan Zitniak
  • Jan Zitniak's Avatar
24 Dec 2011 21:37
K2 search filter by extrafields was created by Jan Zitniak

K2 search filter by extrafields

Category: English K2 Community

Hello.

Could you recommend me search filter module for K2 extrafileds (it should by for Joomla 1.7 and K2 2.5)? I would like to prepare advanced filter by any extrafield for users.

Thanks in advance and Happy Christmas.
Jan
Displaying 141 - 160 out of 248 results.