The user page info
jaykali - August 19, 2009 - 23:02
| Project: | Quota by role |
| Version: | 6.x-7.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Can we join the db query on the user page to the node_type table so that you can show the real name of the content, not the machine name?
Also could you wrap it in a theme function so that the output can be overridden?

#1
I have a patch that will show the "friendly" content type name on the user page:
I have attached the patch and also copied below, let me know if this can be incorporated in dev.
### Eclipse Workspace Patch 1.0
#P leow_drupal6
Index: web/sites/all/modules/quota_by_role/quota_by_role.module
===================================================================
--- web/sites/all/modules/quota_by_role/quota_by_role.module (revision 126)
+++ web/sites/all/modules/quota_by_role/quota_by_role.module (working copy)
@@ -498,7 +498,7 @@
//We check the quota of the user
// We are going to cycle through all of the quota's, and see if there is a matching role in the user's role table
- $sql_result_object = db_query("SELECT q.*, l.*, r.name FROM {quota_by_role_rules} q, {quota_by_role_limit_submissions} l, {role} r WHERE q.rid = r.rid AND q.qid = l.qid GROUP BY q.qid ORDER by q.weight ASC");
+ $sql_result_object = db_query("SELECT q.*, l.*, r.name, nt.name as nice_content_type FROM {quota_by_role_rules} q, {quota_by_role_limit_submissions} l, {node_type} nt, {role} r WHERE q.rid = r.rid AND q.qid = l.qid AND nt.type = l.content_type GROUP BY q.qid ORDER by q.weight ASC");
while(($r = db_fetch_object($sql_result_object))) {
// is this user even in the role given?
@@ -535,9 +535,9 @@
}
if ($per == t('forever'))
- $output .= '<li>' . t('@content_type: You cannot create any more content of this type forever', array('@content_type' => $r->content_type)) . '</li>';
+ $output .= '<li>' . t('@content_type: You cannot create any more content of this type forever', array('@content_type' => $r->nice_content_type)) . '</li>';
else
- $output .= '<li>' . t('@content_type: You have @left posts left for the next @per', array('@content_type' => $r->content_type, '@left' => $r->limit_to - $total_count, '@per' => $per)) . '</li>';
+ $output .= '<li>' . t('@content_type: You have @left posts left for the next @per', array('@content_type' => $r->nice_content_type, '@left' => $r->limit_to - $total_count, '@per' => $per)) . '</li>';
$done[] = $r->content_type;
}