1) Hack example (qa-include/qa-theme-base.php).
function q_view_buttons($q_view) { // Add [start] if (!empty($q_view['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$q_view['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } // Add [end] if (!empty($q_view['form'])) { $this->output('<div class="qa-q-view-buttons">'); $this->form($q_view['form']); $this->output('</div>'); } } ... function a_item_buttons($a_item) { // Add [start] if (!empty($a_item['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$a_item['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } // Add [end] if (!empty($a_item['form'])) { $this->output('<div class="qa-a-item-buttons">'); $this->form($a_item['form']); $this->output('</div>'); } } ... function c_item_buttons($c_item) { // Add [start] if (!empty($c_item['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$c_item['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } // Add [end] if (!empty($c_item['form'])) { $this->output('<div class="qa-c-item-buttons">'); $this->form($c_item['form']); $this->output('</div>'); } }
function q_view_buttons($q_view) { // Add [start] if (!empty($q_view['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$q_view['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } // Add [end]
if (!empty($q_view['form'])) { $this->output('<div class="qa-q-view-buttons">'); $this->form($q_view['form']); $this->output('</div>'); } }
...
function a_item_buttons($a_item) { // Add [start] if (!empty($a_item['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$a_item['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } // Add [end]
if (!empty($a_item['form'])) { $this->output('<div class="qa-a-item-buttons">'); $this->form($a_item['form']); $this->output('</div>'); } }
function c_item_buttons($c_item) { // Add [start] if (!empty($c_item['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$c_item['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } // Add [end]
if (!empty($c_item['form'])) { $this->output('<div class="qa-c-item-buttons">'); $this->form($c_item['form']); $this->output('</div>'); } }
2) Plugin example:
// Add [start] function q_view_buttons($q_view) { if (!empty($q_view['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$q_view['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } qa_html_theme_base::q_view_buttons($q_view); } function a_item_buttons($a_item) { if (!empty($a_item['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$a_item['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } qa_html_theme_base::a_item_buttons($a_item); } function c_item_buttons($c_item) { if (!empty($c_item['form'])) { if(qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { $form = &$c_item['form']; if(isset($form['buttons'])) { $buttons = &$form['buttons']; if(isset($buttons['edit'])) unset($buttons['edit']); } } } qa_html_theme_base::c_item_buttons($c_item); } // Add [end]
Note:
This logic has been considered Ajax. If you do the same thing (changes of array data) in another layer functions, it may not work correctly. If you hack application layer functions, it will be processed more smart.
Welcome to the Q&A site for Question2Answer.
If you have a question about Q2A, please ask here, in English.
To report a bug, please create a new issue on Github or ask a question here with the bug tag.
If you just want to try Q2A, please use the demo site.