Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
BomAle Posted July 22, 2016 Posted July 22, 2016 if(in_array( 'IPS\Content\Permissions', class_implements( $class ) ) AND isset($class::$containerNodeClass) and isset($class::$databaseColumnMap['container'])) { $nodeClass = $class::$containerNodeClass; $join[] = array(\IPS\Db::i()->select( array($class::$databasePrefix . $class::$databaseColumnId, $class::$databasePrefix . $class::$databaseColumnMap['poll']), $class::$databaseTable, \IPS\Db::i()->findInSet( "perm_{$nodeClass::$permissionMap['read']}", \IPS\Member::loggedIn()->groups ) . ' OR ' . "perm_".$nodeClass::$permissionMap['read']."='*'",NULL,NULL,NULL,NULL,0)->join( 'core_permission_index', array( "core_permission_index.app='".$nodeClass::$permApp."' AND core_permission_index.perm_type='".$nodeClass::$permType."' AND core_permission_index.perm_type_id=".$class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['container'] ) ), $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['poll'] . '=core_polls.pid'); } this not cover the parents... but anyone could help to edit this to working also for parents categories? i have already seen the getItemsWithPermissions() but is very chaotic for me
BomAle Posted July 22, 2016 Author Posted July 22, 2016 foreach( \IPS\Db::i()->select( 'perm_type_id', 'core_permission_index', array( "core_permission_index.app='" . $containerClass::$permApp . "' AND core_permission_index.perm_type='" . $containerClass::$permType . "' AND (" . \IPS\Db::i()->findInSet( 'perm_' . $containerClass::$permissionMap['read'], \IPS\Member::loggedIn()->groups ) . ' OR ' . 'perm_' . $containerClass::$permissionMap['read'] . "='*' )" ) ) as $result ) { $categories[] = $result; } if( count( $categories ) ) { $contentWhere[] = array( $class::$databaseTable . '.' . $class::$databasePrefix . $class::$databaseColumnMap['container'] . ' IN(' . implode( ',', $categories ) . ')' ); } else { $contentWhere[] = array( $class::$databaseTable . "." . $class::$databasePrefix . $class::$databaseColumnMap['container'] . '=0' ); } i will try this, run query before insert into $where EDIT: this don't follow hierarchy
Recommended Posts
Archived
This topic is now archived and is closed to further replies.