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

Help on Node Access module developement

I looked into several access control modules that provides the functionality of controlling the access (viewing) to the node either by making it private (private module), password protect (node_protect module), granting permissions based on the user names (nodeaccess module) or by granting permissions based on the buddy groups (buddylist module). What I have NOT found is one single module that completely suits my need. What I would like to have is to provide the ability to the content creators (users) for every content type to choose whether they want the node to be any one of the following (with public being the default):

1. personal (only him/her)
2. private (only friends, if buddylist is enabled),
3. private extended (friends of friends, if buddylist is enabled),
4. protected (password protected) and finally
5. public (anyone)

I am thinking of creating a module by myself, to start with I added two fields to the node table - privacy and password. Privacy will hold any one of 1 thru 5 values above and password will hold the password supplied by the content creator. By using the nodeapi functions this selection field is added to the node creation form (for every type) and the information provided is saved in the database. But my problem is how to control the node visibility. I would like to include the following functionality:

Private taxonomy per user

I'm in interested in creating a Drupal system where each user has their own private taxonomy/vocabulary for freetagging. Has anyone had any experience with creating services using Drupal, where each user gets their own gated CMS? This relates to my privacy bounty. In addition to a users having their own private areas of the Drupal system where only they will view their content, each user would have their own vocabulary for freetagging entries.

Have problems with my custom node-module. Please, help. I'm a newbie.

I'm developing a custom module pretty much similar to news. Well, it is named "news" and serves "news" menu path under MENU_SUGGESTED_ITEM. It is based on node module, and there were no problems with that.

"news" menu path calls "news_page" function callback which simply shows 25 recent news nodes. Every item from that node has a link built with l() that points to news detail page with the following path formula "node/#", where # is $nid. This way, every news item opened has local task links provided by node module, those are "view" and "edit".

The problem is that I don't want url for these news nodes to be "node/#" type. So, I improved "news_page" function callback so it is a little smarter. Now it also serves links followed better formula for news items, such as "news/#". So when arg(1) is numeric and positive "news_page" calls for "news_item" function, to render selected news. And when in overview mode, the urls to news items are now all "news/#". So that was peachy.

But "view" and "edit" local tasks from node module are gone now. That is the problem. I need them!
I know, the path is different, not "node/#" type, and that is why buttons don't show. But I thought there is a way around it.

forms API has no support for anming a form?

Is there a way to use the name attribute in forms api without jumping through hoops? In the docs I see only method and action.

TIA

What purpose does user_access() serve?

I am working on a module to add multiple superusers (as if multiple users had uid 1) to a Drupal site. But before I can start overriding functions, I need to know which ones to override and how to change them. For experimentation purposes, I am modifying core code to see if I can achieve what I'm trying to do.

This is a slightly modified version of user_access() from modules/user/user.module. In theory, it should allow uid 2 to have all the same permissions that uid 1 has, but it does not work.

Is this even the right function to be changing? Are there more than this that I need to change?

function user_access($string, $account = NULL) {
global $user;
static $perm = array();

if (is_null($account)) {
$account = $user;
}

// User #1 has all privileges:
if ($account->uid == 1) {
return TRUE;
}

// User #2 has all privileges: <<<< HERE IS MY CODE
if ($account->uid == 2) {
return TRUE;
}

// To reduce the number of SQL queries, we cache the user's permissions
// in a static variable.
if (!isset($perm[$account->uid])) {
$result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));

$perm[$account->uid] = '';
while ($row = db_fetch_object($result)) {

Stock Module

Hello,
I am trying to modify the stock module so that the portfolio is a bit better. Instead of it erasing ALL the saved stock symbols and then replacing them ALL when you try to add new ones, I've modified it so you can add one symbol at a time. Basically, in the database, the uid and symbol are primary keys, with each being one row in the database. I've also modified the module so that it can pull all the elements, and display their values in the portfolio. The next step is to allow the user to selectively remove stock symbols. I have added a remove button. The purpose of the remove button is to allow the user to remove one symbol, or possibly set of symbols, from their portfolio.

However, the remove button doesn't work. I have something of the form:
db_query("DELETE FROM {mystock} WHERE (uid = %d) and CONVERT(symbols USING utf8) = '%s'", $user->uid,"YHOO");

Pages

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