Forums

Published column only in Admin view, not in Fronbtend view

tibortoth 08 Oct, 2012
Hi to all!

I convert some forms from old CF&CC.
I have {published} column in table, for "admin approve" function of collected data. User updated data, admin receive the email, then go to site, double-check datas and set up "published" state to 1.
All this works on old CC&CF.
But now in V4 (3.5.1 & 3.2) I can add common "WHERE SQL" for published=1 to show all (and ONLY!) published items in Frontend but in this case I dont see unpublished rows in admin view!

Any idea for easy resolve this problem?

Thanks a lot!

Tibor
GreyHead 08 Oct, 2012
Hi Tibor,

Please try:
<?php
$user =& JFactory::getUser();
$groups =& $user->get('groups');
// Note add to or change this array as needed; 8 is the default Super Users group in Joomla! 2.5
$admin_groups = array('8');
$admin = false;
if ( count(array_intersect($groups, $admin_groups)) ) {
  $admin = true;
}
if ( !$admin ) {
  echo " `published` = 1 ";
}
?>

Bob
This topic is locked and no more replies can be posted.