Posted by Wolfflow on May 9, 2008 at 11:14pm
7 followers
Jump to:
| Project: | Statistics filtering |
| Version: | master |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Issue Summary
Hi, I have a Drupal 6.2 Site under costruction.
I have enabled the popular-content Block.
I ask if there can be a way to filter out the "Page not Found" visualisation from
the Popular-content Block.
The error setting page use equivalent selfmaded "Page not found" nodes.
Error 403 as ?q=node/1
Error 404 as ?q=node/2
site: http://www.adaccs.at/drupal2/
Cheers
Comments
#1
Of course it is not a solution but meanwhile you can do an sql query with "phpMyAdmin"
on your Drupal database:
SQL query:SELECT * FROM 'node_counter' WHERE 'totalcount' = (the number of page READS on your "Page not found" node)
SQL query:SELECT * FROM 'node_counter' WHERE 'daycount' = (the number of page views on your node)
Same procedure as for 1.
Of course it will show your "Page not Found" NID Number if you put the number of "reads" this
node have, then you can set it to 0 so that for a while it will not showup again in the "Popular Content" Block.
Cheers
#2
Hi all,
I know that this seems not to care anyone, because most of you Drupalist sure have a PHP solution for that !!
But please let you share your solutions with us (no PHP programmers)
Thanks for your hints, and suggestions of documentation what can help me and others to implement a solution.
Cheers
#3
Just as a consideration:
It's possible to put an SQL Funtion call in the Statistic Module that on activation of the "Popular-content-Block" will check and reset the node_counter for the NID of the a cuastom "Page_not-found(Node)" and the NID for the custom "Forbidden(Page)" = 0 ?
Or can be the possibility to delete or disable the counting for those node_counter items?
Any help is very much appreciate
#4
Why don't you just use views to build a block to what you require?
Views is perfect for that sort of task :)
EDIT:
Also your best bet is to look at what page not found errors you are getting and build some redirects for the highest ones in the .htaccess file (in the root of your site), that way you can redirect the links to what the user expects and keep people coming from that source.
#5
Hi AstralP
If i was that expert with view maybe I have done it, i'm not, and I consider that such a Kind of Bug that is in the
statistical.modul should really be taken in consideration despite the fact that if i give Drupal user the option to
get a custom "Page-not_found" page and a "Forbidden" page in the Drupal administrative settings I should consider that
in the statistic.module wich is Core this event is taken in consideration!
Cheers
#6
The following code if put in a block will give you the All time popular content *excluding* any 403 or 404 pages that have been defined. This is largely cribbed from http://api.drupal.org/api/function/statistics_block/6 and http://api.drupal.org/api/function/statistics_title_list/6.
I agree that something like this should be built-in, probably in core.
<?php
// First define customised version of statistics_title_list()
function statistics_title_list_custom($dbfield, $dbrows) {
// This version excludes nodes used for 403 and 404 pages
$path = $nid = array(); // Arrays to hold path and nid of error pages
foreach (array(403, 404) as $err_code) {
$path[$err_code] = drupal_get_normal_path(variable_get("site_$err_code", ''));
if (substr($path[$err_code], 0, 5) == 'node/') {
$nid[$err_code] = substr($path[$err_code], 5);
}
// If the nid is not valid (i.e. (possibly empty) string, NULL) then set to 0
$nid[$err_code] = is_numeric($nid[$err_code]) ? $nid[$err_code] : 0;
}
if (in_array($dbfield, array('totalcount', 'daycount', 'timestamp'))) {
return db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.uid, u.name FROM {node} n INNER JOIN {node_counter} s ON n.nid = s.nid INNER JOIN {users} u ON n.uid = u.uid WHERE s.$dbfield != 0 AND n.status = 1 AND n.nid != %d AND n.nid != %d ORDER BY s.$dbfield DESC"), $nid[403], $nid[404], 0, $dbrows);
}
return FALSE;
}
// Now get the all time popular content
$alltimetop = variable_get('statistics_block_top_all_num', 0);
if ($alltimetop && ($result = statistics_title_list_custom('totalcount', $alltimetop)) && ($node_title_list = node_title_list($result, t('All time:')))) {
$content = $node_title_list;
}
print $content;
?>
#7
Hi GPK, first that you very much for your cool support.
Very much appraciate and I'm going to implement it right now.
And yes , I know there are some discussions from the core team that this myght be solved or at
list taken in considerationfor the next Drupal release. I hope it will be in the 6.x upgrade version
but surely in version 7. Thank a lot. I let you know.
Cheers
P.S. everything fine on my HP (thanks again)
#8
Hi, am here again shortly for a question: Can this be applyed on Drupal version 5.7 too?
I defenitly suppose no, am I right?
Cheers
#9
I'm also interested in a 5.7 version.
(I did try it in 5.7 but it did not work)
#10
This was written on 5.x, should also work on 6.x. :)
#11
There was a bug at Drupal 5.7 and panel2. It was broke my panel down, maybe you want to take a look for a while. It's working nicely on regular block. Btw how to hidden restricted content type at popular content?
#12
You can use the Statistics Advanced settings to not allow 403 and 404's to be included in node_counter. Considering that the module is in a semi-abandoned (looking for adoption), should this maybe get marked won't fix since there is a solution provided in another (very similar) module?
#13
I suspect Views can also do most if not everything that Statistics Filtering can (and probably much more flexibly), at least in 6.x.
#14
I am still following this issue.
I did not try the code posted in #6 by gpk,
maybe some one did or anyone have a better idea?
#15
I'm not sure whether this use case should be handled by this module.