Hello ,
I am currently looking to understand how the organic groups module works so that i contribute to its development but i am having difficulty understanding from the code how a "delete" button is showing on a group "page" published by an ordinary group subscriber when viewed by a moderator. I can't see how this should be after treading through the code , here's what i have found..
The delete button on the group "page" is rendered here
node.module
1275
/**
* Generate the node editing form.
*/
function node_form($edit) {
..
1364
if ($edit->nid && node_access('delete', $edit)) {
$output .= form_submit(t('Delete'));
}
so node_access() ultimately determines whether this button is rendered on the "page"
821
...
function node_access($op, $node = NULL, $uid = NULL) {
1856 calling og_access or page_access ?
$access = module_invoke(node_get_module_name($node), 'access', $op, $node);
if (!is_null($access)) {
return $access; // returning from here
}
from within node access i know that node_access returns here to node_form
after calling the hook page_access with $op and $node as arguments
page.module
35
function page_access($op, $node) {
global $user;
if ($op == 'create') {
return user_access('create pages');
}
if ($op == 'update' || $op == 'delete') {
if (user_access('edit own pages') && ($user->uid == $node->uid)) {