vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   [RELEASE vB2.0] quick 'who posted' (https://vborg.vbsupport.ru/showthread.php?t=10707)

Kier 03-06-2001 10:00 PM

This is a fairly simple hack, but my users wanted it, so here it is.

http://kier.3dfrontier.com/vbhacks/whoposted.gif

What it does is to add a link to the number of replies for a thread, which allows users to quickly see who has posted in a thread without opening the showthread.php page. The results are shown in a small popup window.

Any suggestions or comments are welcome.

[edit: this hack is now included in vBulletin 2.0.3 and above]

03-07-2001 02:52 PM

Another awesome release from Kier. Thanks again. :)

03-07-2001 03:48 PM

that is nice. Does it use any extra queries on forumdisplay or only when you click on the pop-up? I like it a lot.

03-07-2001 03:52 PM

No extra queries on forumdisplay.php at all. :)

03-07-2001 08:42 PM

Very nice.

I had some people asking for this, one less thing I have to write, thank you so much :)

03-07-2001 09:16 PM

This is COOL!!!

03-07-2001 09:38 PM

Awesome another 5 star rating :)

03-07-2001 10:04 PM

I just installed the hack, and I have to say it was the easiest install I've ever did, the hack works great and it's pretty fast.

I think VBB's dev team ought be looking for someone like you Kier ;)

03-07-2001 10:07 PM

yes i agree - installed it in less than 2 mins :)

works great hopefully it works in all netscape and IE browsers :D

03-07-2001 11:17 PM

Quote:

Originally posted by eva2000
yes i agree - installed it in less than 2 mins :)

works great hopefully it works in all netscape and IE browsers :D

I've tested on NN and no problems at all!

03-08-2001 01:55 AM

man you're just one awsome hacking machine. You just keep on coming and coming and each time they get better and better. :)

03-08-2001 12:05 PM

heh. Nice hack.. might have to install once our site is ready to move to vb 2.0 beta 2. *cough* Rat *cough* Well... there are other reasons for our delay, but.... it's cool. :D

03-08-2001 04:13 PM

Excellent hack.

Keep up the good work.

03-09-2001 12:22 AM

brilliant. Just installed it and it works perfectly. 5 Stars!

03-09-2001 04:08 PM

Cool! Many thanks for that - my users will appreciate it :)

03-10-2001 12:32 PM

http://www.jeuxwebmasters.com/forums...?s=&forumid=19

Nice :)

03-16-2001 03:36 PM

one thing i was wondering, when you move a thread you get the "-" as the number of replies. With this hack it is no underlined because it still works but looks a little silly. Is there any way to not have this when the thread is moved. I would imagine not because you can't do and if elseif routine in the templates but just thought i would ask.

03-16-2001 03:52 PM

It would be fairly easy to implement that, but as you pointed out, it would require a little condition to be placed in the php code, rather than a simple template change.

If you really want it, this is the code to modify:

Find in forumdisplay.php:
Code:

    } else {
      if ($foruminfo[allowratings]) {

replace with
Code:

    } else {
      $thread[replycount] = "<a href=\"javascript:who($thread[threadid])\">$thread[replycount]</a>";
      if ($foruminfo[allowratings]) {

This code should be around line 390... but I can't give you an exact line number, as my forumdisplay.php doesn't really look much like the original ;)

You will also need to remove the hyperlink from the forumdisplaybit template.

03-22-2001 01:57 PM

any way to modify something like this to show who subscribed or selected email notify on a thread ?

03-22-2001 02:49 PM

Yep, open whoposted.php and select the whole SQL query, and replace it with this:
Code:

$posts = $DB_site->query("SELECT
COUNT(postid) AS posts, post.userid, user.username, subscribethread.userid AS subuserid
FROM post LEFT JOIN user USING (userid)
LEFT JOIN subscribethread ON
  (subscribethread.threadid=post.threadid AND subscribethread.userid=user.userid)
WHERE post.threadid=\"$threadid\"
GROUP BY post.userid ORDER BY posts DESC");

then further down the code, find this:
Code:

eval("\$posters .= \"".gettemplate("whopostedbit")."\";");
and immediately above it, add this:
Code:

        if ($post[userid]==$post[subuserid]) $subscribed = " <smallfont>[subscribed]</smallfont>";
        else $subscribed = "";

then open your whopostedbit template and just after the closing </a> of the profile link, add $subscribed.

That oughta do it :)

03-22-2001 03:52 PM

hmm it didn't work nothing no indicator of who subscribed showed up ?

03-22-2001 09:28 PM

oops... you should add $subscribed to your templates... not $subscribe. Sorry.

03-22-2001 10:50 PM

thanks Kier for the change, will do it on next upgrade. cheers.

03-23-2001 01:11 AM

great hack kier.

Just a couple of comments:

1. General comment to all: with regards to the $subscribed thingy, bear in mind that this is a serious invasion of privacy. And, unlike the "who is online", where you allow users to opt out, in adding this $subscrived thingy to the hack you are not allowing anyone any opt-out option.

2. Kier, I LOVE your hacks so please take my following comment as a constructive one: you do not follow strict php coding, which makes it immensely hard to debug a code that consists of your code and others.

Could you perhaps make sure you always use { and } for the ifs and elses? I think in a code made public, strict and global coding guidelines are imperative.

Anyhow, again, thanks for yet another great hack.

Cheers,

Bira

03-23-2001 01:45 AM

Quote:

2. Kier, I LOVE your hacks so please take my following comment as a constructive one: you do not follow strict php coding, which makes it immensely hard to debug a code that consists of your code and others.

Could you perhaps make sure you always use { and } for the ifs and elses? I think in a code made public, strict and global coding guidelines are imperative.
Bira there is no "strict php coding" rulebook that says one must enclose if/then segments withing curly braces. Without curly braces the compiler will only process the first following line for inclusion in the if/then. It is perfectly valid code.

i.e.

Code:

if ($x)
  if ($y)
    if ($z)
      echo "YES";

is the same as and as valid as

Code:

if ($x) {
  if ($y) {
    if ($z) {
      echo "YES";
    }
  }
}


03-23-2001 02:42 AM

This hack is great, but it has a flaw. When you do a search, say for the new posts, or any search for that matter, it does not have the hack in it. I am sure it's a simple bit of code editing but I am just toO damn lazy to look into it...

Lordmusic

03-23-2001 02:44 AM

Quote:

Originally posted by bira
unlike the "who is online", where you allow users to opt out, in adding this $subscrived thingy to the hack you are not allowing anyone any opt-out option.
Okay, if you want to allow users to opt-out, we'll use the invisible setting, so that 'invisible' users don't have their subscriptions shown:

Replace the query with this:
Code:

$posts = $DB_site->query("SELECT
COUNT(postid) AS posts, post.userid, user.username, user.invisible subscribethread.userid AS subuserid
FROM post LEFT JOIN user USING (userid)
LEFT JOIN subscribethread ON
  (subscribethread.threadid=post.threadid AND subscribethread.userid=user.userid)
WHERE post.threadid=\"$threadid\"
GROUP BY post.userid ORDER BY posts DESC");

then change the conditional code to this:
Code:

if ($post[userid]==$post[subuserid] && !$post[invisible]) $subscribed = " <smallfont>[subscribed]</smallfont>";
        else $subscribed = "";

All done. Privacy restored.
Quote:

make sure you always use { and } for the ifs and elses
My new PM hack will be a model of strict coding.
Quote:

Anyhow, again, thanks for yet another great hack.
Welcome.

03-23-2001 02:44 AM

Freddie,

When I have your original code, plus someone else's hack, plus Kier, etc - if the style of coding is not unified, it makes it damn hard to debug if there's a mistake somewhere or a missing curly.

I am not saying this won't work - fact is it does - I am merely asking if possible that hackers restrict themselves to the same "full" (for lack of better word) coding.

03-23-2001 03:47 AM

Quote:

Originally posted by Lordmusic
This hack is great, but it has a flaw. When you do a search, say for the new posts, or any search for that matter, it does not have the hack in it. I am sure it's a simple bit of code editing but I am just toO damn lazy to look into it...

Lordmusic

This would be a simple template edit.

03-23-2001 04:37 AM

A great hack!

A couple of suggestions:

At the bottom of the pop-up box allow the user to click to go the actual thread and to close the window. [you can probably do these in a blink of an eye but I thgout I'd suggest it]

Again, great work!

03-23-2001 05:08 AM

To do that, simply add this to your whoposted template:
Code:

<a href="javascript:opener.location=('showthread.php?s=$session[sessionhash]&threadid=$threadid');">Go to this thread</a>

03-23-2001 05:26 AM

you can add self.close() to that javascript link, and the small window will close while the thread loads in the big window :)

03-23-2001 05:30 AM

thanks fortunately all my members are visible - since i removed the option of being invisible on my forums

03-23-2001 06:18 AM

Thanks!

03-23-2001 07:21 AM

Good idea bira :) For those who are not too familiar with javascript syntax, that would make the link look like this:
Code:

<a href="javascript:opener.location=('showthread.php?s=$session[sessionhash]&threadid=$threadid'); self.close();">Show thread and close this window</a>

03-23-2001 07:39 AM

Just I am too dumb to know which one, please enlighten me...

03-23-2001 04:15 PM

Quote:

Originally posted by freddie


Bira there is no "strict php coding" rulebook that says one must enclose if/then segments withing curly braces.
i.e.

Code:

if ($x)
  if ($y)
    if ($z)
      echo "YES";

is the same as and as valid as

Code:

if ($x) {
  if ($y) {
    if ($z) {
      echo "YES";
    }
  }
}


Not to mention the first makes your code shorter. :) Not to argue, bira, but I always use if ($whatever): instead of if ($whatever) { because I am forever forgetting to close the curly braces. So maybe I'm just lazy :) but I prefer to not use the braces.

03-25-2001 10:58 AM

good hack!

congrats

03-25-2001 11:12 AM

Quote:

Originally posted by tubedogg


Not to mention the first makes your code shorter. :) Not to argue, bira, but I always use if ($whatever): instead of if ($whatever) { because I am forever forgetting to close the curly braces. So maybe I'm just lazy :) but I prefer to not use the braces.

Well, you do have to enclose it in brackets when an if block contains multiple statements...

offtopic:

I don't get why many people code like this:

Code:

if($this) {
  doThis();
  doThat();
  if($that) {
    bla()
  }
}
else {
  doThose();
  doThese();
}

This way you easily forget those brackets to close, especially with nesting if's and else's...

It's far better to code like this:

Code:

if($this)
{        doThis();
          doThat();
        if($that)
        {        bla();
        }
}
else
{        doThose();
          doThese();
}

When I go to the vb-code I often can't see what belongs to where...

03-25-2001 11:38 AM

Quote:

Originally posted by Mas*Mind

Well, you do have to enclose it in brackets when an if block contains multiple statements...

No, not in the alternative method he's talking about.

if you do if(whaterver): then you can have as many statements as you want, up until you write endif;

BUT, that method as well as my previous complaint just makes the code even more incomprehensible.


All times are GMT. The time now is 05:40 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01438 seconds
  • Memory Usage 1,822KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (15)bbcode_code_printable
  • (9)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete