I would like to preface this by stating that I'm not very savvy at php. The code I write is very simplistic compared to what I find in phpbb's code. Unions, joins and arrays often leaves me confused and seeking help. Looking into phpbb's code on viewtopic.php and the relevant template file is sort of like me trying to read a foreign language that I haven't learned. I'm hoping for some guidance on how to add my feature in a way that the creators would approve of, if possible. If not possible due to my inability to grasp the meaning of the code, I would gladly welcome a hack that gets the job done

I created a membermap for my site. I would like to now place a link under the "From:" on viewtopic.php for any member that has placed a pin on the map.
I've created a table called "user_extra" that holds the map data for any member that has placed their pin. The uid of "user_extra" correlates with the phpbb_users "user_id". Here's how I get the pin data for a member:
Code: Select all
// No starting point passed in the URL. Let's check to see if we need to center on user's point.
$query0="SELECT lat, lng FROM user_extra where uid = '$user_id' LIMIT 1";
$result0=mysql_query($query0) or die (mysql_error());
$num0=mysql_num_rows($result0);
if($num0 != '0'){
while ($row0 = mysql_fetch_assoc($result0)) {
$center_lat = $row0['lat'];
$center_lng = $row0['lng'];
}
}
viewtopic.php:
This looks like it's grabbing the post data, including the user info. Maybe I need to do my query here?
Code: Select all
$sql = $db->sql_build_query('SELECT', array(
'SELECT' => 'u.*, z.friend, z.foe, p.*',
'FROM' => array(
USERS_TABLE => 'u',
POSTS_TABLE => 'p',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(ZEBRA_TABLE => 'z'),
'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id'
)
),
'WHERE' => $db->sql_in_set('p.post_id', $post_list) . '
AND u.user_id = p.poster_id'
));
$result = $db->sql_query($sql);
Code: Select all
$user_cache[$poster_id] = array(
'joined' => $user->format_date($row['user_regdate']),
'posts' => $row['user_posts'],
'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0,
'from' => (!empty($row['user_from'])) ? $row['user_from'] : '',
'sig' => $user_sig,
'sig_bbcode_uid' => (!empty($row['user_sig_bbcode_uid'])) ? $row['user_sig_bbcode_uid'] : '',
'sig_bbcode_bitfield' => (!empty($row['user_sig_bbcode_bitfield'])) ? $row['user_sig_bbcode_bitfield'] : '',
'viewonline' => $row['user_allow_viewonline'],
'allow_pm' => $row['user_allow_pm'],
'avatar' => ($user->optionget('viewavatars')) ? get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']) : '',
'age' => '',
'rank_title' => '',
'rank_image' => '',
'rank_image_src' => '',
'username' => $row['username'],
'user_colour' => $row['user_colour'],
'online' => false,
'profile' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$poster_id"),
'www' => $row['user_website'],
'aim' => ($row['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=aim&u=$poster_id") : '',
'msn' => ($row['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=$poster_id") : '',
'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '',
'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '',
'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '',
// START Anti-Spam ACP
'user_flagged' => $row['user_flagged'] ? true : false,
// END Anti-Spam ACP
'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']),
'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']),
'author_username' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']),
'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']),
);
viewtopic_body.html
I would like to have
Code: Select all
<a href='/membermap.php?lat=<user lat>&lng=<user lng>&zoom=8'>View Location</a>
Code: Select all
<!-- IF postrow.POSTER_POSTS != '' --><dd><strong>{L_POSTS}:</strong> {postrow.POSTER_POSTS}</dd><!-- ENDIF -->
<!-- IF postrow.POSTER_JOINED --><dd><strong>{L_JOINED}:</strong> {postrow.POSTER_JOINED}</dd><!-- ENDIF -->
<!-- IF postrow.POSTER_FROM --><dd><strong>{L_LOCATION}:</strong> {postrow.POSTER_FROM}</dd><!-- ENDIF -->
!!!HERE!!!
Any help would be greatly appreciated!