Author |
Message |
dezblack
Hangin' Around
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Nov 26, 2008
Posts: 38
|
Posted:
Wed Nov 26, 2008 2:40 pm |
|
How do I remove the "location" info and add different info (custom fields added with 2.30) in the Authors info when viewing threads? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Wed Nov 26, 2008 4:57 pm |
|
Around line 400 of viewtopic.php you will need to edit to query your new fields.
Code:
//
// Go ahead and pull all data for this topic
//
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
WHERE p.topic_id = '$topic_id'
$limit_posts_time
AND pt.post_id = p.post_id
AND u.user_id = p.poster_id
ORDER BY p.post_time $post_time_order
LIMIT $start, ".$board_config['posts_per_page'];
|
Around line 1195 of viewtopic.php you will have to pass your new fields to the template.
Code:
$template->assign_block_vars('postrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'POSTER_NAME' => $poster,
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
'POSTER_JOINED' => $poster_joined,
'POSTER_POSTS' => $poster_posts,
'POSTER_FROM' => $poster_from,
'POSTER_AVATAR' => $poster_avatar,
'POST_DATE' => $post_date,
'POST_SUBJECT' => $post_subject,
'MESSAGE' => $message,
'SIGNATURE' => $user_sig,
'EDITED_MESSAGE' => $l_edited_by,
|
Then edit viewtopic_body.tpl to include your fields in the page layout.
Note: Do not remove any fields you do not want, just add new ones. That is of course other than in the template. |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dezblack
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Nov 26, 2008 5:30 pm |
|
Thats what I needed! do you know how i can find out what I need to add for my custom fields? I could not find them by digging around in phpmyadmin.. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dezblack
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Nov 26, 2008 9:16 pm |
|
I found the data under _users_fields_values.
How can I pull just the information for the field I need for the posting user?
There are 4 different fields per user. Please forgive me, I'm a begginer =) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Nov 26, 2008 10:51 pm |
|
Without looking I don't know the structure of the custom fields. But It is kind of hard to understand what you are asking. Maybe one of the guys that worked on the new YA will be able to answer this. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dezblack
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Nov 26, 2008 11:14 pm |
|
What you are sating would make complete since of the Custom info was stored under the _user table. But alas, it is stored in its own _users_fields_values table. It appears it will take an advanced query to get the correct info queried to use for the postrow. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
Site Admin
![](modules/Forums/images/avatars/0c0adf824792d6d341ef4.gif)
Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Thu Nov 27, 2008 8:43 am |
|
Well, you need to know which 'fid' values are for the custom fields that you added. You can get those from _users_fields and then you already have the user_id for the user, so you can use that for 'uid' and now you should be able to fashion a query against _users_fields_values to get the values you want. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dezblack
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Jan 25, 2009 2:48 am |
|
vid uid fid value
1 123 1 Champion
2 123 2 55
3 123 3 Daggar, Rolfiki, Breeann
4 123 4 Master Weaponsmith
5 48 1 Lore Master
6 48 2 60
7 48 3 Kitt, Catrian, Snoflakes
8 48 4 Historian
9 47 1 Hunter
10 47 2 60
11 47 3 Mirielle, Manered, Laerien, Markori
12 47 4 All
ok, I want to show fids 1, 2, 3 and 4. So , what would i use to query these and get it inserted in the postrow?
Please forgive my lack of knowledge, i'm trying =) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dezblack
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Jan 25, 2009 3:34 am |
|
well now that i found some info, please forgive me for what i requested =)
I can see the scope is huge!
I need to do some learning, but this seems to be a start:
$result = mysql_query("SELECT * FROM nuke_users_field_values
WHERE uid='48' AND fid='1'")
or die(mysql_error());
// store the record of the "example" table into $row
$row = mysql_fetch_array( $result );
// Print out the contents of the entry
echo $row['uid']." - ".$row['value']; |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
montego
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Jan 25, 2009 9:18 am |
|
It does take some SQL and PHP language skills to do, yes. I would suggest getting yourself a MySQL book and a basic PHP book, as I am sure you will want to do more hacking of code (customization) in the future.
Enjoy the road of learning. I sure have. We cannot necessarily take the time to write the code for you, but if you get stuck down the road, we'll try and help as you progress along this journey. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Jan 25, 2009 11:51 am |
|
This sql statement that you are trying to edit isn't exactly the easiest one to be learning on with all the u., p., pt. stuff. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Jan 25, 2009 12:22 pm |
|
Just to give you a few hints. If you where just writing sql statements in pure php you would use mysql_query and mysql_fetch_array, but since we are writing in php nuke you need to use $db->sql_query and $db->sql_fetchrow. They will probably both work, but that is what you want.
Code:
$result = mysql_query("SELECT * FROM nuke_users_field_values
WHERE uid='48' AND fid='1'")
or die(mysql_error());
|
You are going to just want to select all fields with a uid equal to the user in question. You do not want to use where fid='1'. You want to select them all with one statement and then read them with a while loop. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dezblack
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Jan 26, 2009 12:21 pm |
|
Well, i'm trying to play with some code to figure out how to pull the results from each fid. I have to specify the fid in the query to get the correct value to display. I can't get it to display correctly in my table though any suggestions or any links to where I can read up on my problem?
heres my code:
Code:$query = "SELECT NUKE_USERS.username, NUKE_USERS.user_id, NUKE_USERS_FIELD_VALUES.uid, NUKE_USERS_FIELD_VALUES.fid, NUKE_USERS_FIELD_VALUES.value ".
"FROM NUKE_USERS
LEFT JOIN NUKE_USERS_FIELD_VALUES ".
"ON NUKE_USERS.user_id = NUKE_USERS_FIELD_VALUES.uid
AND fid='1'
";
$result = mysql_query($query) or die(mysql_error());
echo "<center>";
echo "<table border='1'>
<tr>
<th>Username</th>
<th>Class</th>
<th>Alts</th>
</tr>";
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['value'] . "</td>";
}
$query2 = "SELECT NUKE_USERS.username, NUKE_USERS.user_id, NUKE_USERS_FIELD_VALUES.uid, NUKE_USERS_FIELD_VALUES.fid, NUKE_USERS_FIELD_VALUES.value ".
"FROM NUKE_USERS
LEFT JOIN NUKE_USERS_FIELD_VALUES ".
"ON NUKE_USERS.user_id = NUKE_USERS_FIELD_VALUES.uid
AND fid='3'
";
$result2 = mysql_query($query2);
while ($row2 = mysql_fetch_array($result2)) {
echo "<td>" . $row2['value'] . "</td>";
echo "</tr>";
echo "</table>";
}
|
and heres the result:
Only registered users can see links on this board! Get registered or login!
As you can see, I can get the correct info, but it will not show in the table correctly =( |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|