PDA

View Full Version : Question About Hacks...


09-16-2000, 01:55 AM
Howdy Everyone,

I'm thinking about taking a shot at writing a small hack for vBulletin...something I'd love for my own board and something I think will be useful for others...but, I have a problem:

I'm only so-so with PHP and MySQL, which means my code will likely be AMAZINGLY sloppy/messy and un-organized...and probably not nearly the most efficient way to do what I want to do.

My question is: should I even bother? Does the neatness of the code matter, or does it simply have to function?

Thanks! :)

09-16-2000, 03:05 AM
If it works then it must be great. I am sure some of the experts here will be happy to suggest improvements to make it quicker/more efficient.

09-16-2000, 04:37 AM
Ok, cool.

Just so you know: I've gone ahead and begun work...and so far it looks really good! The result...that is: not the code!

Another downside is that I'd have to organize it, provide installation instructions...and then comment it all over the place. :)

Tell ya'll what: I'll keep working on it...if it works fine on my tests, then I'll install it on my board (or some test board) and let you all see it - if you decide you all like it, I'll make it available to everyone...but I will DEFINETLY need help cleaning it up! :)

Anyone guess what the hack is yet? :)

09-16-2000, 05:05 AM
Well i was guessing the poll but without dampening any spirits i think that has already been made and will definitely be included in the next vbulletin release.

09-16-2000, 12:54 PM
No no, not the poll.

I'm trying to create a "My Favorite Threads" area where people can save different threads for later viewing. So far its working out well...I'll probably need help at some point using cookies for the username and password, etc.

My code is VERY sloppy, but so far it works! :)

09-16-2000, 01:19 PM
That is really cool. I think there was a thread back sometime where we discussed ideas about this. Someone created a cool looking image to give an indication of how it would work. Perhaps you saw that.

I certainly look forward to seeing it, an excellent feature.

09-16-2000, 01:25 PM
Didn't see that, but did see a few threads about it...one of them was me requesting it, and another was someone else semi-requesting it...

09-16-2000, 04:32 PM
yeah, code polish is important, especailly in mysql calls. you can often reduce the calls with some nice programming tricks.

09-16-2000, 05:03 PM
doron: could you tell me more about that, either here or through email (chris@movieforums.com)? I'd appreciate some help with "polishing"...my hack is basically functional...all it comes down to now is polishing, documenting and just a tiny thing or two about the templates. :)

09-16-2000, 06:45 PM
I think it's done!

It's functional, at least...I do have a few problems still I'd like to fix:

http://www.spunkyjunk.com/testboard/index.php

Username: test
Password: test

Go ahead and try saving topics...there's a link on each thread underneath the Email to a friend/Print Thread links...

And YES, I made the folder icon for the fivelinks template, and I created the little yellow disk - cool, huh?

The one thing I really think it's lacking (other than the use of templates...I'm getting to that!) is a username and password ALREADY entered when the page loads...like when you post a reply - what code can I use to grab that cookie info like vB does?

Thanks! If the response merits it, I'll finish this hack and release it...want to see if you all have use for it first.

09-16-2000, 07:06 PM
It is certainly great. Here come my list of suggestions:

1) Not log in bit, if you are already logged in then should skip those log in bits
2) on the front there should be a system that says "6 of your saved topics has new replies" or something like that
3) How you going to order the saved topics?
4) Make it into pop-up so a little box comes up with your saved topics.
5) templates would of course be good.
6) no sure what you have done to "5 links" but the pages with the saved threads on them do not have the yellow folder images
7) Sort the saved threads under categories so it does:

Category Group > Category
Thread 1
Thread 2
Thread 3
Category Group > Category 2
Thread 4
Thread 5

8) Make the thread number input thing a hidden field. No point showing that to the vistors, it will only confuse them

Well just some ideas anyway, take what you want from it.

09-16-2000, 07:08 PM
Other thing, it is possible to save the same thread more than once. Need to stop that being possible.

09-16-2000, 07:57 PM
If someone can help me learn more about vB's use of cookies I think I might be able to list the topics with new replies and skip the login bit...the latter definetly needs to be done, but right now I cannot do it on my own.

I'll order the saved topics alphabetically I suppose - but I plan to make them fully sortable - however the user wants! :)

I just changed the 5 links one...the only reason it doesn't show up on the "new" files is because they don't use templates...I don't know enough about the templates to use them on those pages!

As you can see, this can all be done:

Anyone willing to lend me a hand with the cookies and templates? I think this has the potential to be a VERY cool hack! :)

09-16-2000, 08:13 PM
By "categories"...do you mean from the forum? Or user-created categories? I'm creating user-categories right now...basically like folders. I don't think most people pay attention to the category names (IE: Customizing vBulletin) as much as they do Forum Names (IE: vBulletin Code Hacks)...

I'm brainstorming on some other things...organization by forums, etc. We'll see what happens!

Now I have something to do while waiting for someone to come and help :)

09-16-2000, 08:22 PM
Use this at the top of your showthread.php to detect if a user is logged in and if not, send them to a login page. The no_permission template already exists so you do not need to create it.



if ($bbuserid == 0)
{
eval("echo standarderror(\$bbtitle,\"".gettemplate("error_nopermission")."\");");
exit;
}

if ($bbusername == "" || (isset($bbusername))==0)
{
$getusername=$DB_site->query_first("SELECT username FROM user WHERE userid=$bbuserid");
$username=$getusername[username];
$bbusername = $username;
}
else
{
$username = $bbusername;
}


You can reference the users "bblastactivity" time setting in the user table to decide if something is "new" or not.

09-17-2000, 02:59 AM
Hey rangersfan,

Thanks for the code - works like a charm! I'm a bit vague on the bblastactivity thing though - I'm no good with cookies unfortunatly.

I'd also appreciate any help anyone can offer on how to simply call upon one of the script's templates...right now the files are just black text and blue links on a white background. :)

Features included so far:
- Two glistening new icons (:D)
- Ability to save a thread with one click if logged in
- Ability to delete thread with one click from saved pages
- Sorting so that you can view the topics you've saved all on one page, or view topics saved from a specific forum.
- A handy-dandy drop-down jump box to navigate through the saved threads.


Coming Up (I hope!):
- Searching the saved threads area.
- Viewable listings of saved threads with new posts in them.
- Prevention of adding the same thread twice.

...and hopefully I'll be able to include the number of replies, date of last post, etc...although I'm not sure where to start with that. I think I have to get to know the inner-workings of vB a bit more. :)


[Edited by TWTCommish on 09-17-2000 at 12:02 AM]

09-17-2000, 08:57 AM
Originally posted by TWTCommish
doron: could you tell me more about that, either here or through email (chris@movieforums.com)? I'd appreciate some help with "polishing"...my hack is basically functional...all it comes down to now is polishing, documenting and just a tiny thing or two about the templates. :)


Well, you should check the calls to the db and see if you can reduce them somehow, by either changing 2
short ones into 1 longer one and that kinda stuff. I can look at the code and see what I can do.