Thank for all your info. ok i understand, may since the code is very simple, can be modified with easy on each case.
It will be done, included the form to put custom content.
Beside the language phrases, that i've be warned to change, and that i will go to change now, or variables names,
what i worry is that to rewrite the value of post text or to set as hidden the related record into the event array, it require to clone the passed event param, then re-assign to it the new one cloned and modified.
Anybody want to help on understand why, the event array values cannot be overwritten within a foreach inside the event function?
https://github.com/axew3/phpbb-display- ... er.php#L87
how could be switched this simple code so to not have to do
$tempRW = $e['rowset'];
, but doing a foreach directly into the $e['rowset'] without cloning it? I know that this question make you all laugh, anyway i only have to hide posts here in the right way, so i will do the question without shame
Code: Select all
$vx = $e['topic_data']['topic_first_post_id'];
$tempRW = $e['rowset'];
// Replacement mode:
// $this->config['w3all_displayonlyfirstpost_rep_mode'] == 1 (Hide the entire post content)
// $this->config['w3all_displayonlyfirstpost_rep_mode'] == 0 (Replace the post text with custom content)
foreach($tempRW as $r => &$v){ // set as hidden (or replace the post content) all posts except the first
if($r != $vx){
if( $this->config['w3all_displayonlyfirstpost_rep_mode'] > 0 )
{
$v['hide_post'] = 1;
} else {
$v['post_text'] = $this->language->lang('DISPLAYONLYFIRSTPOST_EVENT_REPLACEMENT_TEXT');
}
}
}
$e['rowset'] = $tempRW;
unset($v,$tempRW);
Thank you!
ps
to be more clear, doing this:
Code: Select all
foreach($e['rowset'] as $k => &$v){ // set as hidden (or replace the post content) all posts except the first
print_r($e['rowset'][$k]['post_text']);
$e['rowset'][$k]['post_text'] = 'test';//$this->language->lang('DISPLAYONLYFIRSTPOST_EVENT_REPLACEMENT_TEXT');
print_r($e['rowset'][$k]['post_text']);exit;
}
change nothing into
$e['rowset']
, the second
print_r($e['rowset'][$k]['post_text'])
still show the old value and not the word
test