first of all, i know pretty close to zero about php - just what i've learned from putting up my drupal site. so, i would really like some feedback. i wanted to be able to dictate that anonymous users only have access to some pages but not all pages, while authenticated users have access to all pages ("page" content is really the only kind of content that i'm using so far). in other words, i want anonymous users to have to log in if they want to see more than just a few pages of my site. in order to do that, i also wanted to be able to choose on the page submission that i want that particular page content to be public.
what i did seems to work so far - if there's some reason why i shouldn't do it, please let me know!!!
anyway, what i did was:
1. create another radio button in the page submission between "static on front page" and "create new revision" in node.module. around 1180 or so, find
$options .= form_checkbox(t('Published'), 'status', 1, isset($edit->status) ? $edit->status : variable_get('node_status_$edit->type', 1));
and then add below 'static':
$options .= form_checkbox(t('Make public content'), 'public_content', 1, isset($edit->public_content) ? $edit->public_content : variable_get("node_public_content_$edit->type", 0));
also find near the bottom of node.module:
function node_nodeapi(&$node, $op, $arg = 0) {
and add:
$output[t('public_content')] = form_checkbox('', "node_public_content_$node->type", 1, variable_get("node_public_content_$node->type", 0));
then, just below find and add "public_content":
return array('nid', 'uid', 'type', 'title', 'teaser', 'body', 'revisions', 'status', 'promote', 'moderate', 'static', 'public_content', 'created', 'changed');
2. create another row in the admin/account/permission page called "access public content" (done in node.module under "function node_perm()" when "access public content" is added to line, i think.)
3. create another field after "static" in the node table called "public_content"
4. find all instances of "access content" in node.module, page.module, and user.module and copy and paste those sections below the "access content" lines, and then make the copy into "access public content" sections
5. in node.module look for function node_admin_nodes(), copy the static line below and replace "static" in the view portion with "public" and replace "status" with "public_content" - like so:
array(t('View posts that are public'), 'WHERE n.public_content = 1 AND n.public_content = 1 ORDER BY n.changed DESC')
6. in the next section, do almost the same thing - after the "static" line - it should look something like:
array(t('Make the selected posts public'), 'UPDATE {node} SET status = 1, public_content = 1 WHERE nid = %d'),
i think that's all i did. some reason why i shouldn't do this?? will it screw something up?
eva
ps
the only thing that seems to be a little funky, and i don't know why is that the page will show to an anonymous user even if the "make public content" radio button and "access public content" (in permissions)check box are NOT checked AND when a node/view url is used. for example, if it says, node/view/9 - the page will
be accessible to anonymous users even when "access content" (in permissions)is NOT checked and when "make public content" is NOT checked. the only remedy seems to be to taxonify it (nice word, eh?) by making it something like: taxonomy/page/or/9 and then the page will ONLY be accesible when "access public content" and "make public content" are checked. if you have any idea why it does this, so i might be able to fix it, i'd appreciate it...thank you.