- Posts: 4
COMMUNITY FORUM
Author Name Problem
- DINESH
-
Topic Author
- Offline
- New Member
Less
More
15 years 1 month ago #81419
by DINESH
Author Name Problem was created by DINESH
Hello,
In my website i added k2 component for user blogs and those users blogs are in unpublished state till the admin approve those. When i logged in as admin and edit that entry and click on publish button then it displays the author as my name instead of the blog creator..How can i solve this problemI will explain in more detail..Let us assume user "front1" created a blog entry and it is currently in unpublished state , so super admin logged in as "superadmin" and edit that entry to check that content is not a spam. so after checking it super admin chooses publish radio button and click on save then it displays the blog author as "superadmin" instead of "front1"Can any one fix this issueAny help appreciatedThanksdinesh
In my website i added k2 component for user blogs and those users blogs are in unpublished state till the admin approve those. When i logged in as admin and edit that entry and click on publish button then it displays the author as my name instead of the blog creator..How can i solve this problemI will explain in more detail..Let us assume user "front1" created a blog entry and it is currently in unpublished state , so super admin logged in as "superadmin" and edit that entry to check that content is not a spam. so after checking it super admin chooses publish radio button and click on save then it displays the blog author as "superadmin" instead of "front1"Can any one fix this issueAny help appreciatedThanksdinesh
Please Log in or Create an account to join the conversation.
- DINESH
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 4
15 years 1 month ago #81420
by DINESH
Replied by DINESH on topic Author Name Problem
Hai kris,
I rectified this problem by modifying the code
administrator/components/com_k2/views/item/view.html.php After line number 163 Place this
$db =& JFactory::getDBO();
$sql = 'SELECT id AS value,name AS text FROM #__users where id='.$item->created_by;
$db->setQuery($sql);
$author_info[] = JHTML::_('select.option', '0', JText::_( 'Select Author' ), 'value', 'text' );
$author_info = array_merge( $author_info, $db->loadObjectList() );
$lists = JHTML::_('select.genericlist', $author_info, 'created_by', 'size="1" class="inputbox"', 'value', 'text', $item->created_by);
//$lists = JHTML::_('list.users', 'created_by', $active, false);
And also make sure to comment out the line..
$lists = JHTML::_('list.users', 'created_by', $active, false);
After that go to administrator/components/com_k2/models/item.php after line number 82
Place the following
if($row->id!=''){
$row->created_by = $row->created_by;
}
if($row->id!=''){
$row->modified_by = $row->created_by;
}
You can now edit those entries in the admin panel and those entries will keep the actual author info with out over writing..
I rectified this problem by modifying the code
administrator/components/com_k2/views/item/view.html.php After line number 163 Place this
$db =& JFactory::getDBO();
$sql = 'SELECT id AS value,name AS text FROM #__users where id='.$item->created_by;
$db->setQuery($sql);
$author_info[] = JHTML::_('select.option', '0', JText::_( 'Select Author' ), 'value', 'text' );
$author_info = array_merge( $author_info, $db->loadObjectList() );
$lists = JHTML::_('select.genericlist', $author_info, 'created_by', 'size="1" class="inputbox"', 'value', 'text', $item->created_by);
//$lists = JHTML::_('list.users', 'created_by', $active, false);
And also make sure to comment out the line..
$lists = JHTML::_('list.users', 'created_by', $active, false);
After that go to administrator/components/com_k2/models/item.php after line number 82
Place the following
if($row->id!=''){
$row->created_by = $row->created_by;
}
if($row->id!=''){
$row->modified_by = $row->created_by;
}
You can now edit those entries in the admin panel and those entries will keep the actual author info with out over writing..
Please Log in or Create an account to join the conversation.
- dancing buddha
-
- Offline
- New Member
Less
More
- Posts: 8
14 years 7 months ago #81421
by dancing buddha
Replied by dancing buddha on topic Author Name Problem
Hi,
I am very new to both Joomla and K2 and do not have much coding skill.
I am facing the exact same problem as Dinesh and I saw the solution here.
Now what I am worried is whether I need to put the piece of code suggested at the same place or not (i.e. at line 163). y version of K2 is K2_v2.4.1.zip
For your help, I am pasting few lines of code to show what is there in and around of administrator/components/com_k2/views/item/view.html.php at Line 163
159 jimport('joomla.html.pagination');
160 $total = $item->numOfComments;
161 $pagination = new JPagination($total, $limitstart, $limit);
162
163 }
164
165 }
166
167 //Author's latest items
168 if ($params->get('itemAuthorLatest') && $item->created_by_alias == '') {
169 $model = &$this->getModel('itemlist');
170 $authorLatestItems = $model->getAuthorLatest($item->id, $params->get('itemAuthorLatestLimit'), $item->created_by);
Eagerly waiting for reply and it is urgent for me.
Thanks in advance.
I am very new to both Joomla and K2 and do not have much coding skill.
I am facing the exact same problem as Dinesh and I saw the solution here.
Now what I am worried is whether I need to put the piece of code suggested at the same place or not (i.e. at line 163). y version of K2 is K2_v2.4.1.zip
For your help, I am pasting few lines of code to show what is there in and around of administrator/components/com_k2/views/item/view.html.php at Line 163
159 jimport('joomla.html.pagination');
160 $total = $item->numOfComments;
161 $pagination = new JPagination($total, $limitstart, $limit);
162
163 }
164
165 }
166
167 //Author's latest items
168 if ($params->get('itemAuthorLatest') && $item->created_by_alias == '') {
169 $model = &$this->getModel('itemlist');
170 $authorLatestItems = $model->getAuthorLatest($item->id, $params->get('itemAuthorLatestLimit'), $item->created_by);
Eagerly waiting for reply and it is urgent for me.
Thanks in advance.
Please Log in or Create an account to join the conversation.