Displaying wrong number of entries and text for Admin

Andrzej7 - June 21, 2006 - 03:54
Project:G2 Glossary
Version:4.7.x-1.x-dev
Component:User interface
Category:support request
Priority:normal
Assigned:fgm
Status:closed
Description

Hello, I'm very happy to find such a great module. I was tired to start and try to make work a wiki (mediawiki), And I found, that for a small project your module coud work for that function. I'm not a programmer, but maybe you will be ready to add some features and G2 can be a quite nice small Drupal_wiki :-)

To bugs in one:

entries starting by initial d

Displaying 0 entries starting by 'd' from a total number of entries.

Admin info: there are also 0 unpublished matching entries from a total number of unpublished entries.

There is one antry, but it displays number 0.
The "Admin info" is showed to everybody. Could it be restrected to the main site admin (or to the "administrator of g2 entries")?

Thanks for the module

Andrzej

#1

fgm - June 24, 2006 - 08:47
Category:bug report» support request
Assigned to:Anonymous» fgm

This is really two issues in one.

First, the "admin info" being show: this information is normally displayed only for users having the administer g2 entries permission, set from page admin/access, or automatically granted to user 1.

Can you confirm what happens when you remove that permission for users who don't need it ?

Second: I could not reproduce the problems. Are you sure you actually have G2 terms (definitions) in your node table ? What do you see when you run this query (use phpmyadmin or devel.module):

select  nid, vid, type, title, status from node where type like 'g2%'

It seems like you don't have created any G2 content yet, at least starting with letter 'd'

There's a minor issue you didn't mention, though: when there was no term matching an initial, the admin info would miss the 0s in the total counts. This is fixed with CVS version 1.15.2.4

#2

Andrzej7 - June 24, 2006 - 16:12

Thanks for your answer.

First: Admin info.
You are right. But look: when I'm not logged in - I see:
http://gabinetcieni.pl/G2_1.jpg

I try to log in (not successfully) - and I see:
http://gabinetcieni.pl/G2_2.jpg

(registered users have granted permission to administer g2 entries). After that I see all the time this admin message.

Second: number of entries:

When putting your code in the php page in Drupal (in phpmyadmin it didn't work) - I see:
Parse error: syntax error, unexpected T_STRING in /includes/common.inc(1150) : eval()'d code on line 2. But in the "node" table, I see 5 etries: g2_entry.

Bur look at this:
http://gabinetcieni.pl/g2/initial/d

There are 3 entries - you can see them - and the message:
"Displaying 0 entries starting by 'd' from a total number of entries."

I'm using the 4.7 version. I will switch to cvs.

Thanks for your time

Andrzej

#3

fgm - June 24, 2006 - 19:06

Weird. First things first, are you using HEAD, 4.7.x or 4.6x ?

G2 is only supported for 4.7.x and is not expected to support HEAD until at least the 4.8 RC versions happen. Also, make sure you installed the latest 1.15.2.4 version.

Now, supposing you are using 4.7.x, you just shouldn't give any users the permission to administer G2 entries if you don't want them to access the admin info. They don't need that permission just to read the nodes.

Regarding the SQL code, it should work in PHPMyAdmin for your DB. If you are using it in the execute PHP code function of Drupal, it should look like (without the <?php / ?>) :

<?php
$q
= db_query("select  nid, vid, type, title, status from {node} where type like 'g2%'");
$ret = '<ul>';
while (
$o = db_fetch_object($q))
 
$ret .= '<li>' . print_r($o, true) . '</li>' ;
$ret .= '</ul>';
echo
$ret;
?>

For more details, look at the code for function _g2_stats($tid, $initial) and play a bit with it (you can use it from the execute PHP code page), to identify where the problem lies.

In addition, I suggest you contact me directly if this is not enough for you to find the solution or identify a bug in G2.

#4

Andrzej7 - June 25, 2006 - 04:36

I'm using D4.7 with G2-4.7 - 1.15.2.4 version.

After the php query I get:

# stdClass Object ( [nid] => 6 [vid] => 10 [type] => g2_entry [title] => domek [status] => 1 )
# stdClass Object ( [nid] => 8 [vid] => 13 [type] => g2_entry [title] => malutki 2 [status] => 1 )
# stdClass Object ( [nid] => 9 [vid] => 18 [type] => g2_entry [title] => mały [status] => 1 )
# stdClass Object ( [nid] => 11 [vid] => 20 [type] => g2_entry [title] => deregulacja [status] => 1 )
# stdClass Object ( [nid] => 12 [vid] => 21 [type] => g2_entry [title] => demon [status] => 1 )

Access control: administer g2 entries - registered
view g2 entries - unregistered

After changing for 1.15.2.4 version - disapeared the problem with http://gabinetcieni.pl/G2_2.jpg

Thanks!

But it's still showing ) above the entries:

entries starting by initial M

Displaying <b>0</b> entries starting by 'M' from a total number of <b>0</b> entries.

Admin info: there are also 0 unpublished matching entries from a total number of 0 unpublished entries.

    * malutki 2: xcvbcv (+)
    * mały: To jest teaser. (+)

see: http://gabinetcieni.pl/g2/initial/M

Function: _g2_stats($tid, $initial) - I can't find it in g2.module file - I found: line 265 - 6:

  $arTotal   = _g2_stats();
  $arInitial = _g2_stats(0, $initial);

so it's 0 instead od $tid

Sorry I'm a total beginner in php code :-(

#5

fgm - June 25, 2006 - 08:38
Status:active» fixed

There was actually an MySQL behaviour dependency in the code producing the stats, that would work on some versions, and not on others.

This is fixed in g2.module 1.15.2.5.

Note, however, that "administer g2 entries" permission should not be granted to anonymous users.

#6

Andrzej7 - June 25, 2006 - 22:17

Happy that I could help to develop such a great module.

Thanks

Andrzej

#7

Anonymous - July 9, 2006 - 22:30
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.