-
Hello Scholar !
Sorry, but there is no ready method to show only the public posts from the author. It will require to write a new one.
Hi LeonidS. I've tracked the browse_author method and it passes arguments to the function
_updateCurrentForAuthor (). here is the code for it:
protected function _updateCurrentForAuthor($sMode, $aParams, &$oProfileAuthor) { $CNF = &$this->oModule->_oConfig->CNF;
$oProfileAuthor = BxDolProfile::getInstance((int)$aParams['author']); if (!$oProfileAuthor) return false;
$iProfileAuthor = $oProfileAuthor->id(); if (bx_get_logged_profile_id() == $iProfileAuthor || $this->oModule->_isModerator()) { // for real owner and for moderators show anonymous posts $this->aCurrent['restriction']['author']['operator'] = 'in'; $this->aCurrent['restriction']['author']['value'] = array($iProfileAuthor, -$iProfileAuthor); } else { $this->aCurrent['restriction']['author']['value'] = $iProfileAuthor; }
if(!empty($aParams['except'])) $this->aCurrent['restriction']['except']['value'] = is_array($aParams['except']) ? $aParams['except'] : array($aParams['except']);
if(!empty($aParams['per_page'])) $this->aCurrent['paginate']['perPage'] = is_numeric($aParams['per_page']) ? (int)$aParams['per_page'] : (int)getParam($aParams['per_page']);
$this->sBrowseUrl = 'page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id={profile_id}'; $this->aCurrent['title'] = _t($CNF['T']['txt_all_entries_by_author']); $this->aCurrent['rss']['link'] = 'modules/?r=' . $this->oModule->_oConfig->getUri() . '/rss/' . $sMode . '/' . $iProfileAuthor;
return true; }where can I add a statement to exclude non-public posts?
-
-
If you're OK tomodify this code then you may add the following line:
$this->aCurrent['restriction'] ['public'] => array('value' => BX_DOL_PG_ALL, 'field' => 'allow_view_to', 'operator' => '=');
after this one:
if(!empty($aParams['per_page'])) $this->aCurrent['paginate']['perPage']
-
If you're OK tomodify this code then you may add the following line:
$this->aCurrent['restriction'] ['public'] => array('value' => BX_DOL_PG_ALL, 'field' => 'allow_view_to', 'operator' => '=');
after this one:
if(!empty($aParams['per_page'])) $this->aCurrent['paginate']['perPage']
that worked great, but I had to put it in the else statement to allow owners to view their non-public posts.
-