This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

create public content permission for anonymous users kosher???

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.

Amazon module update

I've taken a swag at updating the Amazon module to 4.4. I have it running on the administrative menus, but it isn't at all apparent how you are supposed to invoke it otherwise. There is a block which appears to provide possible book matches for a given page, but that's not what I'm interested in.

Has anyone gotten the Amazon module working under an earlier version on a site that I could browse? I'd like to see the functionality actually 'working' before I try to debug things under 4.4.

Thanks!

Flexinode - custom field display

I've installed the (amazing!) Flexinode module for Drupal 4.4 and have run into a problem with displaying the custom fields that I've added to my new content type. When a page created with a flexinode is promoted to the front page, only the Title and Description fields are shown (not the custom drop down box or check boxes that i've added). These other fields are only displayed when you click on the Title to view the node. I have set the node setting for 'Length of Trimmed Posts' to 'Unlimited', but that didn't affect it.

Node ID in blocks?

I'm working in Xtemplate designing a custom block. I want to display "related content", so I need the Node ID# so I know what content is related. My code so far works, except that I can't figure out how to access the nid! $node->nid and for that matter $node are empty, global $node; doesn't seem to help, nor using $GLOBALS["$node"]. It seems like there must be a simple answer that I'm too new to PHP and Drupal to know when I've stumbled across it.

Alphabetic index module

I created an alphabetic (a-z) index module for node titles and was wondering if anyone has experience creating Keyword in Context (KWIC) displays using PHP/MySQL.

Source for the module is here at alpha_index.module.phps. I apologize if my code is poor. Any suggestions on how to code this are appreciated.

forum_link

Is anyone planning on updating forum_link? I was hoping that someone might consider making it so that forum posts and comments were the same thing. And or have the articles automatically placed under the correct taxonomy in the forums.

Cheers,
Tom

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions