|
|
|
View previous topic :: View next topic |
Author |
Message |
ChrisWiggles Opinionated SOB
Joined: 12 Mar 2006 Posts: 2529 Location: Seattle
|
Link Posted: Fri Sep 21, 2007 2:13 am Post subject: Drop-down sub-forum list? |
|
|
Say, does the drop-down subform list not work for anyone else? Whenever I select a subforum, and click go, it always takes me to the CRT Projector sub forum. To visit any of the other subforums I have to go to the index and the click the link, the drop-down menu doesn't work for me. Just wondering if that's only me, or if others have this same problem?
-chris
|
|
Back to top |
|
|
kal Forum Administrator
Joined: 06 Mar 2006 Posts: 17860 Location: Ottawa, Canada
TV/Projector: JVC DLA-NZ7
|
|
Back to top |
|
|
AnalogRocks Forum Moderator
Joined: 08 Mar 2006 Posts: 26690 Location: Toronto, Ontario, Canada
TV/Projector: Sony 1252Q, AMPRO 4000G
|
Link Posted: Fri Sep 21, 2007 5:45 am Post subject: |
|
|
We have/had a drop down list?
_________________ Tech support for nothing
CRT.
HD done right!
|
|
Back to top |
|
|
ChrisWiggles Opinionated SOB
Joined: 12 Mar 2006 Posts: 2529 Location: Seattle
|
Link Posted: Fri Sep 21, 2007 5:12 pm Post subject: |
|
|
I was fiddling around with it Kal, and I don't understand, it works sometimes, but usually not. And when it doesn't it returns me to the same sub-forum. So I dunno, it's a weird one that's for sure! I just wanted to make sure I wasn't crazy!
|
|
Back to top |
|
|
kal Forum Administrator
Joined: 06 Mar 2006 Posts: 17860 Location: Ottawa, Canada
TV/Projector: JVC DLA-NZ7
|
|
Back to top |
|
|
ryan
Joined: 10 Mar 2006 Posts: 13 Location: Pennsylvania, USA
|
Link Posted: Sat Sep 22, 2007 5:00 am Post subject: |
|
|
Looks like a pretty simple fix...
There's a nested form in viewforum.php (which, in turn, appears to be in templates/subSilver/viewforum_body.tpl).
If you move the closing tag for the unnamed "post" form on line 197 so that it's before {JUMPBOX} (say up to line 178 maybe), I think it should work.
Obviously double-check that won't break anything else first .
-- Ryan
P.S. As a random aside, you may or may not also want to consider removing the "highly recommended" from line 38 of templates/subSilver/overall_footer.tpl .
|
|
Back to top |
|
|
kal Forum Administrator
Joined: 06 Mar 2006 Posts: 17860 Location: Ottawa, Canada
TV/Projector: JVC DLA-NZ7
|
|
Back to top |
|
|
jask
Joined: 17 Mar 2006 Posts: 10165 Location: kamloops BC
|
Link Posted: Sat Sep 22, 2007 7:56 pm Post subject: |
|
|
kal wrote: | Oh crap. That reminds me that I need to fix this feature (I seem to have broken it some time ago ...). Either fix it or remove it....
So yes, it's broken. I've added it to my TODO list.
Kal |
Kal I wish the ratio of done portion of my to do list to the remaining todo looked that good
Thanks again for all the work that we never get to see.
|
|
Back to top |
|
|
ryan
Joined: 10 Mar 2006 Posts: 13 Location: Pennsylvania, USA
|
Link Posted: Wed Sep 26, 2007 4:12 am Post subject: |
|
|
I took a look at the last few TODO items left and, if you're interested, I think they might be relatively painless to fix/implement...
But firstly, some Caveats and Disclaimers:
- I know just enough HTML/CSS/PHP/SQL to be dangerous.
- This has been quickly tested with PHP 5.2.3, MySQL 5.0.45, and phpBB 2.0.22.
The suggestions may or may not work with other versions, or because of other MODs already installed.
- I believe this code to be both working and secure, however, I can not be held responsible for any loss incurred due to it's failure (even if the issue would be both obvious and egregious to someone who knows what they're doing).
- It is worth exactly what I'm charging, which is $0.
- Feel free to use, not use, and/or modify it in any way.
- In a nutshell, use only at your own risk.
kal wrote: | Fix redirect after post/edit to go right to the post in question instead of to top of thread (this one's more complex than it sounds). | As far as I can tell, isn't this already working? (In fact it now appears to be the default behavior, at least with phpBB 2.0.22.)
kal wrote: | Jump to forum drop-down doesn't work in some places... need to investigate. | It doesn't look like anything would be broken by moving </form> from line 197 to line 178 in templates/subSilver/viewforum_body.tpl, so that's still what I'd suggest.
kal wrote: | Printer friendly view doesn't seem to always work right with really big threads. Investigate... | This is only available to Club Members (i.e. I'm not even sure what the output looks like when it's working, let alone when it's not ), but a total guess would be that you may be hitting the PHP memory_limit, or possibly max_execution_time. In the former case, you could try: Code: | //... Look for a block of code like, or similar to, the following: ...//
if(isset($HTTP_GET_VARS['printertopic']))
{
// Add the line below, where 16M is instead maybe twice whatever the current memory_limit is.
ini_set('memory_limit', '16M');
//... Leave Existing Code Here ...//
}; | Are there any entries in the PHP error log when it breaks?
Would it be possible for someone to post a screen capture and/or the script's output (just a Save As... [HTML Only] would be fine) from a thread long enough to break it?
kal wrote: | User name search in memberlist page. | This one's a bit harder... I couldn't find an existing MOD, but here's a relatively simple method that seems to work fine with phpBB 2.0.22:
Make the following changes to memberlist.php:
Add this between the "Memberlist sorting" and "Generate page" sections: Code: | //
// Find a member by username.
//
$unsafe_search = ''; $safe_search = ''; $where_clause = ''; // Initialize the variables.
$paginate_link = "memberlist.$phpEx?mode=$mode&order=$sort_order"; // Set the default base link for pagination.
if ( $mode != 'topten' ) // Check that we're not in "Top Ten" mode, where username search makes no sense.
{
if ( isset($HTTP_POST_VARS['search_username']) ) // Check if the POST variable is set (from Search button).
{ $unsafe_search = $HTTP_POST_VARS['search_username']; } // Assign it to UNSAFE.
else if ( isset($HTTP_GET_VARS['search_username']) ) // Or if the GET variable is set (from pagination links).
{ $unsafe_search = $HTTP_GET_VARS['search_username']; }; // Assign it to UNSAFE.
// Shorten the length to 25 characters and eliminate non-alphanumerics, _, or -.
$unsafe_search = preg_replace('/[^a-zA-Z0-9_-]/', '', substr($unsafe_search, 0, 25));
if ( strlen($unsafe_search) > 0 ) // Check if we still have an acceptable search.
{
$safe_search = $unsafe_search; // Assign the verified UNSAFE to SAFE.
$where_clause = " AND username LIKE '%$safe_search%'"; // Then generate an SQL WHERE statement.
$paginate_link .= "&search_username=$safe_search"; // Append the search_username to the base link for pagination.
};
}; |
Add/change this in the "Generate page" section:
Original: Code: | $template->assign_vars(array(
//... Any Variables Not Listed Should Remain Unchanged ...//
'L_ORDER' => $lang['Order'],
'L_SUBMIT' => $lang['Sort'],
'S_MODE_ACTION' => append_sid("memberlist.$phpEx"))
); | New: Code: | $template->assign_vars(array(
'L_ORDER' => $lang['Order'].':', // Add the missing colon to localized "Order".
'L_SUBMIT' => $lang['Search'], // Set the submit button text to localized "Search".
'S_MODE_ACTION' => append_sid("memberlist.$phpEx"),
'S_MEMBER_SEARCH' => $safe_search, // Populate a variable for the username search text entry (i.e. when the page is reloaded).
'S_NO_RESULTS' => '') // Used to display an error if no results where found.
); |
Change the WHERE clause in the SQL query: Code: | $sql = "SELECT username, user_id, user_viewemail, user_posts, user_regdate, user_from, user_website, user_email, user_icq, user_aim, user_yim, user_msnm, user_avatar, user_avatar_type, user_allowavatar
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS . "
ORDER BY $order_by";
| To: Code: | WHERE user_id <> " . ANONYMOUS . $where_clause . " // Include the search_username WHERE clause. |
At the end of: Code: | if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
//... A Lot of Code to Retrieve and Format the Member Data ...//
$db->sql_freeresult($result);
} | Add this else statement: Code: | else
{
$template->assign_vars(array('S_NO_RESULTS' => $lang['No_such_user'])); // There were no members to display.
}; |
Change the WHERE clause in the SQL query: Code: | $sql = "SELECT count(*) AS total
FROM " . USERS_TABLE . "
WHERE user_id <> " . ANONYMOUS; | To: Code: | WHERE user_id <> " . ANONYMOUS . $where_clause; // Include the search_username WHERE clause here, too. |
At the end of: Code: | if ( $row = $db->sql_fetchrow($result) )
{
$i = 0;
//... A Lot of Code to Retrieve and Format the Member Data ...//
$db->sql_freeresult($result);
} | Add this else statement: Code: | else
{
$template->assign_vars(array('S_NO_RESULTS' => $lang['No_such_user'])); // There were no members to display.
}; |
Change the line: Code: | $total_members = $total['total']; | To: Code: | $total_members = ($total['total'] > 0) ? $total['total'] : $board_config['topics_per_page']; // Handle the case of zero results. |
Change the line: Code: | $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). ' '; | To: Code: | $pagination = generate_pagination($paginate_link, $total_members, $board_config['topics_per_page'], $start) . ' '; |
Make the following changes to templates/subSilver/memberlist_body.tpl:
On line 6 change: Code: | <td align="right" nowrap="nowrap"><span class="genmed">{L_SELECT_SORT_METHOD}: {S_MODE_SELECT} {L_ORDER} {S_ORDER_SELECT} | To: Code: | <td align="right" nowrap="nowrap"><span class="genmed">Username: <input type="text" name="search_username" size="20" maxlength="25" value="{S_MEMBER_SEARCH}"> {L_SELECT_SORT_METHOD}: {S_MODE_SELECT} {L_ORDER} {S_ORDER_SELECT} |
On line 37 change: Code: | <td class="catBottom" colspan="9" height="28"> </td> | To: Code: | <td class="catBottom" colspan="9" height="28" align="center"> {S_NO_RESULTS} </td> |
Then, with any luck, that should do it. Of course if anything blows up, don't forget the disclaimer.
-- Ryan
|
|
Back to top |
|
|
kal Forum Administrator
Joined: 06 Mar 2006 Posts: 17860 Location: Ottawa, Canada
TV/Projector: JVC DLA-NZ7
|
Link Posted: Wed Sep 26, 2007 5:30 pm Post subject: |
|
|
Wow Ryan - Thanks! I'll take a look once I get a chance.
What are you using as the code-base when doing these comparisons? My current phpBB version is exactly one version behind and I've got 100's of mods already installed in most files so the line numbers wouldn't be the same.
You can view TPL files directly of course (if you know what to look for) but that's only display stuff. Trying to look at PHP files directly doesn't work.
Kal
_________________
Support our site by using our affiliate links. We thank you!
My basement/HT/bar/brewery build 2.0
|
|
Back to top |
|
|
ryan
Joined: 10 Mar 2006 Posts: 13 Location: Pennsylvania, USA
|
Link Posted: Thu Sep 27, 2007 2:45 am Post subject: |
|
|
kal wrote: | Wow Ryan - Thanks! I'll take a look once I get a chance. | No problem... And do feel free to use or modify it however you see fit. Or not use it all if it isn't what you were looking for.
kal wrote: | What are you using as the code-base when doing these comparisons? My current phpBB version is exactly one version behind and I've got 100's of mods already installed in most files so the line numbers wouldn't be the same. | The changes above were written for and tested against an unmodified install of phpBB v2.0.22. It looks like there's been only minor changes to memberlist.php at least as far back as v2.0.19. The one difference (in the sections that would need to be modified for implementing a simple search, anyway) I can see is going to be from the Last Visit MOD. Theoretically, though, my suggestions should still be valid. (Example: The modifications made by Last Visit definitely effect the first SQL query I mention, but those changes only apply to the SELECT columns... The WHERE clause can [probably] still be changed as suggested.)
kal wrote: | You can view TPL files directly of course (if you know what to look for) but that's only display stuff. | The line numbers mentioned in reference to templates/subSilver/viewforum_body.tpl and templates/subSilver/memberlist_body.tpl were for the files being used on this site (at least at the time my message was posted).
kal wrote: | Trying to look at PHP files directly doesn't work. | Indeed, which is why I couldn't provide any specific line numbers to alter them. You'll have to find the relevant lines/sections by hand, sorry . I put them in order from the top down, though, so I hope it's reasonably easy to figure out what should be where even with many other MODs installed. Alternately, I could attempt to translate those changes into an actual MOD file myself.
A few other caveats I should mention (of course, they can all be changed/fixed if required) in regard to the username search:- My code doesn't quite adhere (in mostly cosmetic ways) to phpBB coding guidelines.
- The handling of user input differs somewhat from the way search.php works. For better or worse, depending on your point of view:
- The "purifying" regular expression just gets rid of anything that's not a letter, number, underscore, or hyphen.
(Which may prevent searching for some usernames, or make it more difficult than it needs to be.)
- There's a hard-coded wildcard at the beginning and end of the search string.
(Meaning it will find a match that occurs anywhere in the username.)
- This line:
Code: | $total_members = ($total['total'] > 0) ? $total['total'] : $board_config['topics_per_page']; | Can be just: Code: | $total_members = ($total['total'] > 0) ? $total['total'] : '1'; | While it does work as originally posted, I initially misunderstood the intention because of a bug (not mine) in that section of code.
A quick, useless summary (since it shouldn't effect this board):- If $board_config['topics_per_page'] is set to less than 10 and 'topten' mode is selected, then $total_members (and subsequently $pagination) actually gets count(*) for all users instead of 10. Hrm.
-- Ryan
|
|
Back to top |
|
|
kal Forum Administrator
Joined: 06 Mar 2006 Posts: 17860 Location: Ottawa, Canada
TV/Projector: JVC DLA-NZ7
|
Link Posted: Thu Sep 27, 2007 3:02 am Post subject: |
|
|
ryan wrote: | You'll have to find the relevant lines/sections by hand, sorry . I put them in order from the top down, though, so I hope it's reasonably easy to figure out what should be where even with many other MODs installed. Alternately, I could attempt to translate those changes into an actual MOD file myself. |
Oh god no, please don't do that! That would be an enormous amount of work for you! Just to make sure you know, most of the things left on my TODO list aren't there because I don't know how to do them... just the opposite: They're just ideas and things I add to the list as I remember and when I have some free time (rare) I take a look. So please don't spent too much time as I know how much time this stuff takes. Just the stuff you've already provided is a few hours of work!
Kal
_________________
Support our site by using our affiliate links. We thank you!
My basement/HT/bar/brewery build 2.0
|
|
Back to top |
|
|
kal Forum Administrator
Joined: 06 Mar 2006 Posts: 17860 Location: Ottawa, Canada
TV/Projector: JVC DLA-NZ7
|
|
Back to top |
|
|
kal Forum Administrator
Joined: 06 Mar 2006 Posts: 17860 Location: Ottawa, Canada
TV/Projector: JVC DLA-NZ7
|
Link Posted: Fri Oct 26, 2007 3:46 pm Post subject: |
|
|
I've implemented the username search feature that ryan documented above on the memberlist page (with a couple of minor changes).
Works great. You can enter any text and it'll filter the list. It works in conjunction with the other filters up there, so you could for example (though I don't know why) list the top posters with the word "guy" in their username:
Code: | 1 cabinetguy 387
2 AvgOrdinaryGuy 74
3 tubesguy 17
4 the_avguy 16
5 Programguy 11
6 hotguy8289 10
7 Soupguy 3
8 viguy 2
9 nguyennd 2
10 pjguy 1
11 silentsoundguy32 1
12 wvpinballguy 0
13 ps3 guy 0
|
"PS3 GUY" is going to have to busy if he wants to catch up to "CABINETGUY".
Thanks again Ryan!
Kal
_________________
Support our site by using our affiliate links. We thank you!
My basement/HT/bar/brewery build 2.0
|
|
Back to top |
|
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Forum powered by phpBB © phpBB Group
|
|