I think I traced down my issue to this line of code in a module:

l($node->name, "blog/$node->uid")

I am just quickly wondering, is there any known effects the l() function has with a user's access privledges.

Under admin, I can see all the outputs ---it goes into an array. When anonymous, I see nothing.

Thanks

Comments

esend7881’s picture

I want to add that I realize my anonymous user settings don't allow access to actual content. However the information in that code snippet above is simply the link to that content.

So even though the actual content is blocked, I'd like the links and information still accessed...

mm167’s picture

who wrote that module?

uid is the user id. for anonymous users, the user id is unknown. Ask the developer what he wants for anonymous users?

esend7881’s picture

No, its the user ID of the blogger.

Sorry for being unclear. I am usering the "Blogger" module to help me create a resume book for a class. Of course, I need to modify things. For example, I want it to say "Resumes" not "Bloggers" in the titles. That wasn't too bad.

Here is the code for the function that outputs the list. This is where the issue lies:

function blogger_page_list() 
{    
  $maxdisp  = 1000;	
  $shownum  = variable_get("blogger_shownum", 0);  
  $blogger_order  = variable_get("blogger_order", 0);
  $blogger_exclude = variable_get("blogger_exclude", "'0'");
   
  $blogger_case   = variable_get("blogger_case", 0); 
  $blogger_avatar = variable_get("blogger_avatar", 0); 
  $blogger_avatar_width = variable_get("blogger_avatar_width", 0);
  $blogger_avatar_height = variable_get("blogger_avatar_height", 0);
  
  $sql_counts = " SELECT DISTINCT (u.name)"
	           ." FROM {users} u"
	           ." INNER JOIN {node} n ON n.uid=u.uid"
	           ." WHERE u.name<>'' AND n.type='blog' AND n.status=1"
		       ;
  $dse_sql_counts = db_query($sql_counts);
  $cnt_sql_counts = db_num_rows($dse_sql_counts);
  $sql_counts = "SELECT $cnt_sql_counts";
	
  $sql = " SELECT n.uid, u.name, count(u.name) AS numitems, u.picture, n.title "
      ." FROM {node} n "
      ." INNER JOIN {users} u ON u.uid = n.uid "
	  ." WHERE n.type = 'blog' AND n.status=1 "
	  ." and n.uid not in ($blogger_exclude) "
	  ." GROUP BY n.uid"
	  .($blogger_order<>0 ? " ORDER BY " : "")
	  .($blogger_order==1 ? "u.name" : "")
	  .($blogger_order==2 ? "numitems DESC, u.name" : "")
	  .($blogger_order==3 ? "n.created DESC, u.name" : "")
	  .($blogger_order==4 ? "RAND()" : "")
	  ;
  $sql = db_rewrite_sql($sql);
	
  //$results = pager_query($sql, 1, 0, $sql_count, COMMENT_PUBLISHED, $uid, $uid);
  $results = pager_query($sql, $maxdisp, 0, $sql_counts);
	
  $i=1;
  while ($node = db_fetch_object($results)) {  
    //l($node->title, "node/$node->nid") .' '. theme('mark', node_mark($node->nid, $node->changed)),
    switch ($blogger_case)  
	{
      default:
      case 0:
        break;
      case 1: //smallcase
        $node->name = strtolower($node->name);
        break;
      case 2: //uppercase
        $node->name = strtoupper($node->name);
        break;
      case 3: //Wordcase
        $node->name = ucwords($node->name);
        break;
    }
      
    //Latest blog
	$sql = " SELECT n.title, nid "
	      ." FROM {node} n "
		  ." WHERE n.uid = '$node->uid' AND n.type='blog' AND n.status=1"
		  ." ORDER BY n.created DESC"
		  ." LIMIT 1"
		  ;
    $latest_blogs = db_query($sql);
    $latest_blog  = db_fetch_object($latest_blogs);
	//  
	if (($blogger_avatar) AND ($node->picture<>"")) 
	{ 
	  $blogger_img  = base_path().$node->picture;
	  $showpict = "<img src='$blogger_img' align='center'"
	           .($blogger_avatar_width<>0 ?  " width=$blogger_avatar_width " : " ")
	  		   .($blogger_avatar_height<>0 ? " height=$blogger_avatar_height " : " ")  
		       ."></>";
	}
	else
	{ $showpict = ""; }
	//  
    if (!$blogger_avatar)
	{  
      $rows[] = array(
        l($node->name, "blog/$node->uid"), //This isn't working for anonymous users.
        //$node->numitems,
        //l($latest_blog->title, "node/$latest_blog->nid")
      );
    } else {
	  $rows[] = array(
        l($node->name, "blog/$node->uid"), //
        //$node->numitems,
        //l($latest_blog->title, "node/$latest_blog->nid"),
		"$showpict"
	  );
	}
  }
  if (!$blogger_avatar) { $header = array( t('Name')/*,t('Numbers of Resumes'),t('Resume') */); }
  else { $header = array( t('Name'), /*t('Numbers of Resumes'),t('Resume'),*/ t('Picture') ); }

  $output = '<div id="blogger"><br/><br/>';
  $output .= theme('table', $header, $rows);
  $output .= theme('pager', NULL, $maxdisp, 0);
  $output .= '</div>';

  return $output;
}

The $output variable contains all the information we want to list. Namely, the array "rows"

So for some reason, the "rows" array isn't being created when an anonymous user calls this function.

cog.rusty’s picture

What is $node? Are you loading the node with a $node = node_load($some-nid) before that? Maybe that is what anonymous users don't have permission for, and they get an empty node object.

If that is the case, you may need another way to get the node's name and its author's uid directly from the database, bypassing access control.

igor_galtsev’s picture

Anonymous user must have UID == 0 (zero).
Try to add in the table "users" 1 row with uid==0, status==1, name=='anonymous user'