needed that functionality, hope it helps

Comments

Als’s picture

Tried it on Drupal 5.10 with CMF 5.x-1.4: works fine.
It is a much needed option and does not add much to module code. Hope it gets added in next release!

canen’s picture

The patch works fine except there doesn't seem to be anyway to allow access to just a user's content. The 'filter and manage site content' permission seems to still be needed. In addition a count query is needed since if there are 100 nodes and I only created 5 I'll only see 5 but the pager will account for 100, hence it will still show up. The query needs to look something like this:


switch ($kind) {
    case 'node':
      $count_query = "SELECT COUNT(*) FROM {node} n INNER JOIN {users} u ON n.uid = u.uid {$filter['join']} {$filter['where']}";

      return pager_query('
        SELECT n.nid, n.title, n.type, u.name AS username, u.uid, n.status, n.created, n.changed
        FROM {node} n INNER JOIN {users} u ON n.uid = u.uid '. $filter['join'] .
        $filter['where'] .
        tablesort_sql($header),
        isset($_SESSION['cmf_max_rows']) ? $_SESSION['cmf_max_rows'] : 50, 0, $count_query, $filter['args']
      );
      break;
     
     //-------------


The other queries will need to be taken into account as well.

canen’s picture

OK, some updates on the permission front. This patch requires that the user have 'filter and manage site content' permission to view their own nodes in addition it allows you to view any other users content. The menu function needs to be changed get a proper user only content listing:


   global $user; // new
   
   // arg(1) now checks against the current user's id 
    if (arg(0) == 'user' && is_numeric(arg(1)) && arg(1) > 0 && arg(1) == $user->uid ) {
      $items[] = array(
        'path'        => 'user/'. arg(1) .'/cmf',
        'title'       => t('CMF'),
        'description' => t('User-specific content management filter'),
        'callback'    => 'cmf_admin_content_page',
        'access'      => $owner_access || $view_access, // replaced $manage_access with $owner_access
        'type'        => MENU_LOCAL_TASK,
      );
    }

I am just making notes as I go along.

nancydru’s picture

Status: Needs review » Needs work

Per canen, changing status. FYI, the count query problem is fixed.

nancydru’s picture

Since there is the CMF tab on the "My account" page, why give a my-content-only user 'filter and manage site content' permission to start with?

nancydru’s picture

Status: Needs work » Closed (works as designed)

IMO, this is handled with the permissions changes to the user tab. Feel free to reopen if you disagree.