[SOLVED] customize my front-end editor

GK User
Sun Dec 25, 2011 7:56 pm
How can I remove the featuring option from my front-end editor.
I do not want my front-end editors to have the option to feature their posts, in K2 front editor.

Thanks
User avatar
Expert Boarder

GK User
Sat Jan 07, 2012 10:25 am
Easy way to accomplish is to delete featured section from frontend all together. So anyone editing from frontend simply will not see featured option. This will not change in back-end.

You can make changes to it so it checks user level then display the code however i don't have time to do that as it requires customization.

Find File: \components\com_k2\templates\default\itemform.php
Find Line: 147 to 154
Which is below
Code: Select all
                        <tr>
                           <td class="adminK2LeftCol">
                              <label for="featured"><?php echo JText::_('K2_IS_IT_FEATURED'); ?></label>
                           </td>
                           <td class="adminK2RightCol">
                              <?php echo $this->lists['featured']; ?>
                           </td>
                        </tr>

Delete all of above so around the code looks as below.
Code: Select all
                        <?php if($this->mainframe->isAdmin() || ($this->mainframe->isSite() && $this->permissions->get('publish'))): ?>
                        <tr>
                           <td class="adminK2LeftCol">
                              <label><?php echo JText::_('K2_PUBLISHED'); ?></label>
                           </td>
                           <td class="adminK2RightCol">
                              <?php echo $this->lists['published']; ?>
                           </td>
                        </tr>
                        <?php endif; ?>
                     </table>
                     
                     <!-- Tabs start here -->


See you around...
User avatar
Platinum Boarder

GK User
Mon Jan 09, 2012 3:24 am
Norman, can U make time for this customization? I could pay if is not very complex and expensive...

Thanks
User avatar
Expert Boarder

GK User
Mon Jan 09, 2012 5:43 pm
Done below which should be sufficient which shows featured in frontend editing if user is admin or if user is Super User.

Backup File: \components\com_k2\templates\default\itemform.php
Mods;

Find Line: 12 which is empty add below;
Code: Select all
$user = & JFactory::getUser();

So line 10 to 13 looks as below
Code: Select all
// no direct access
defined('_JEXEC') or die('Restricted access');
$user = & JFactory::getUser();
$document = & JFactory::getDocument();


Find Line: 146 to 166 which is below
Code: Select all
                        <?php if($this->mainframe->isAdmin() || ($this->mainframe->isSite() && $this->permissions->get('publish'))): ?>
                        <tr>
                           <td class="adminK2LeftCol">
                              <label for="featured"><?php echo JText::_('K2_IS_IT_FEATURED'); ?></label>
                           </td>
                           <td class="adminK2RightCol">
                              <?php echo $this->lists['featured']; ?>
                           </td>
                        </tr>
                        <tr>
                           <td class="adminK2LeftCol">
                              <label><?php echo JText::_('K2_PUBLISHED'); ?></label>
                           </td>
                           <td class="adminK2RightCol">
                              <?php echo $this->lists['published']; ?>
                           </td>
                        </tr>
                        <?php endif; ?>
                     </table>
                     
                     <!-- Tabs start here -->

Replace it with below
Code: Select all
                        <?php if(isset($user->groups['Administrator']) || isset($user->groups['Super Users'])): ?>
                        <tr>
                           <td class="adminK2LeftCol">
                              <label for="featured"><?php echo JText::_('K2_IS_IT_FEATURED'); ?></label>
                           </td>
                           <td class="adminK2RightCol">
                              <?php echo $this->lists['featured']; ?>
                           </td>
                        </tr>
                        <?php endif; ?>
                        <?php if($this->mainframe->isAdmin() || ($this->mainframe->isSite() && $this->permissions->get('publish'))): ?>
                        <tr>
                           <td class="adminK2LeftCol">
                              <label><?php echo JText::_('K2_PUBLISHED'); ?></label>
                           </td>
                           <td class="adminK2RightCol">
                              <?php echo $this->lists['published']; ?>
                           </td>
                        </tr>
                        <?php endif; ?>
                     </table>
                     
                     <!-- Tabs start here -->


See you around...
User avatar
Platinum Boarder

GK User
Tue Jan 10, 2012 3:13 am
Works like a charm!!
Beautiful... thanks a lot :woohoo:

I did change the line 146 to reflect my user types...
Code: Select all
                                                <?php if(isset($user->groups['Editor en Jefe']) || isset($user->groups['Super Users'])): ?>


And I will make some tests to add other users types...

thanks again...
User avatar
Expert Boarder

GK User
Tue Jan 10, 2012 11:33 am
No problem at all , marking this topic as solved.

See you around...
User avatar
Platinum Boarder

GK User
Wed Feb 01, 2012 12:31 am
Hello

Something happend when updating joomla to 2.5 and updating gavick modules. but this customization is gone, now my selected users can't see teh featuring option..

Any idea why??

thanks
User avatar
Expert Boarder

GK User
Wed Feb 01, 2012 1:44 pm
As I can see, Norman has suggested you to change only in K2 file then please check if you also upgraded K2, if you did not, then please check if the new template overrides that file by checking if file itemform.php exists under \templates\gk_twn2\html\com_k2\templates\default\. I'm downloading the template to check the same but download speed is sucking so please help me check it as well.
User avatar
Platinum Boarder

GK User
Wed Feb 01, 2012 4:04 pm
checking if file itemform.php exists under \templates\gk_twn2\html\com_k2\templates\default\


No It does not exist; should I add the one with the hack in this folder?
User avatar
Expert Boarder

GK User
Thu Feb 02, 2012 12:46 am
Hello

If the template does not overwrite the file, and the k2 file still the same?
Maybe users in Joomla 2.5 are call different?

and this line is not working??

Code: Select all
<?php if(isset($user->groups['Administrator']) || isset($user->groups['Super Users'])): ?>


Pelase help, this was solved and now I can not get it back to work...

thanks
User avatar
Expert Boarder

GK User
Thu Feb 02, 2012 10:45 am
I'm sorry I'm not really a K2 expert. As this is a problem from K2 component then you can always contact JoomlaWorks team to get support as well. Thanks for understanding.
User avatar
Platinum Boarder

GK User
Thu Feb 02, 2012 8:07 pm
Still no answer in K2 will post here...
User avatar
Expert Boarder

GK User
Fri Feb 03, 2012 1:35 am
Although I haven't managed to research on joomla 2.5 changes, below code works fine. I've tested this in my local installation so test in your installation and let me know if it works.

Replace :
Code: Select all
$user = & JFactory::getUser();

With:
Code: Select all
$userGroups = & JFactory::getUser()->get('groups');

Replace:
Code: Select all
<?php if(isset($user->groups['Administrator']) || isset($user->groups['Super Users'])): ?>

With:
Code: Select all
<?php if (isset($userGroups['8']) || isset($userGroups['7'])): ?>

Replace numbers 8 and 7 with your corresponding groups id. You can find your groups id in Joomla Admin > Users > Groups , then on the right you will see id numbers.

See you around...
User avatar
Platinum Boarder

GK User
Fri Feb 03, 2012 1:49 am
Worked! thansk
User avatar
Expert Boarder

GK User
Fri Feb 03, 2012 2:03 am
No problem at all.

See you around...
User avatar
Platinum Boarder


cron