Topic: viewtopic.php mod installing error

Well I'm re-installing the Colored Username Mod, and now it's saying this:

#---------[ 25. OPEN ]---------------------------------------------------
#

viewtopic.php

#
#---------[ 26. FIND (line:186) ]---------------------------------------------------
#

$result = $db->query('SELECT DISTINCT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

#
#---------[ 27. REPLACE WITH ]---------------------------------------------------
#

$result = $db->query('SELECT DISTINCT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, g.g_color, o.user_id AS is_online FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'users AS u ON u.id=p.poster_id INNER JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id LEFT JOIN ' . $db->prefix . 'online AS o ON (o.user_id=u.id AND o.idle=0) WHERE p.topic_id=' . $id . ' ORDER BY p.id LIMIT ' . $start_from . ',' . $pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());


But there's no '' SELECT DISTINCT' in my viewtopic.php


I can find the rest but there's no SELECT DISTINCT ..

Re: viewtopic.php mod installing error

It looks to me like you just have to add g.g_color to the list of columns in the select query

Re: viewtopic.php mod installing error

Smartys wrote:

It looks to me like you just have to add g.g_color to the list of columns in the select query

Where? tongue

Re: viewtopic.php mod installing error

Also, I just changed it and it works, on userlist and viewtopic, but not in the index.

hmm

Re: viewtopic.php mod installing error

winger wrote:
Smartys wrote:

It looks to me like you just have to add g.g_color to the list of columns in the select query

Where? tongue

In the main query in viewtopic.php

winger wrote:

Also, I just changed it and it works, on userlist and viewtopic, but not in the index.

hmm

Make sure you followed the instructions properly for index.php

6 (edited by winger 2007-06-19 17:43)

Re: viewtopic.php mod installing error

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $result = $db->query('SELECT g.g_color, t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT g.g_color, t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());


I've tried it like this, but that doesn't works. It says 'Unable to fetch topic info' or something.

Could you tell me where and how exact to put it?
smile

winger wrote:

Also, I just changed it and it works, on userlist and viewtopic, but not in the index.

hmm

Make sure you followed the instructions properly for index.php

I've re-checked all things 3 times REALLY carefully.

big_smile

Re: viewtopic.php mod installing error

That's not the main query, look further down viewtopic.php
The query looks very similar to the one they wanted you to modify

Re: viewtopic.php mod installing error

Smartys wrote:

That's not the main query, look further down viewtopic.php
The query looks very similar to the one they wanted you to modify

This one?
/ Retrieve the posts (and their respective poster/online status)
$result = $db->query('SELECT DISTINCT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, g.g_color, o.user_id AS is_online FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'users AS u ON u.id=p.poster_id INNER JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id LEFT JOIN ' . $db->prefix . 'online AS o ON (o.user_id=u.id AND o.idle=0) WHERE p.topic_id=' . $id . ' ORDER BY p.id LIMIT ' . $start_from . ',' . $pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());


With all those u.blabla

?

Re: viewtopic.php mod installing error

Yes, except that query is old and not the one you should be using. Like I said, just use the query that exists and add g.g_color to the list of columns in the select query

10

Re: viewtopic.php mod installing error

I have no Idea what your talking about. Could you please be clear?
And i've just noticed it already says g.g_color in the list I showed you above,  in the end,....



? hmm

Re: viewtopic.php mod installing error

I am being clear.
The code you're looking at looks like this for an unmodded PunBB

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

I want you to add g.g_color to the column list there, like this

$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, g.g_color, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

12

Re: viewtopic.php mod installing error

It already says that:

$result = $db->query('SELECT DISTINCT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, g.g_color, o.user_id AS is_online FROM ' . $db->prefix . 'posts AS p INNER JOIN ' . $db->prefix . 'users AS u ON u.id=p.poster_id INNER JOIN ' . $db->prefix . 'groups AS g ON g.g_id=u.group_id LEFT JOIN ' . $db->prefix . 'online AS o ON (o.user_id=u.id AND o.idle=0) WHERE p.topic_id=' . $id . ' ORDER BY p.id LIMIT ' . $start_from . ',' . $pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

^= From viewtopic.php line: 194.