Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-07-2010, 07:18 PM
NovoCiv NovoCiv is offline
 
Join Date: Aug 2010
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Some code modifications I am trying to figure out

I have taken to modifying the source code within various files such as newthread.php to make my forums do what I like. For example, I've changed the ban system to allow bans as low as 1 hour long, as well as giving the moderators the ability to input the length of the ban rather than choose from a list of predefined lengths.

Normally to make this work I dig around files looking for whatever makes things work, then tinker with the code until I get it to do what I want. Sometimes I can't figure out which files do what I want.

-One of the things I'm stuck on is this nasty message: The message you have entered is too short. Please lengthen your message to at least 1 characters.

My forums are relaxed and our rules allow for users to simply quote or blankpost without adding anything to the discussion. Right now the members have to put effort into blankposting by adding a broken image, changing the color of their text, or typing , and these methods aren't perfect. (Broken image shows up in quote, colored text shows up on highlight or different theme, alt-code shows up as box in chrome). I want users to be able to just press quote and reply, or to just press reply and post a blank message. I spent some time reading through newreply.php, and I think I might get by with a line like:
$newpost['message'] = 'blank.png';
But I feel like that wouldn't work well and I'd rather just remove whatever code generates an error when a message is empty. I couldn't find what file has this code, any suggestions?

-Another thing I am trying to figure out is a suggestion by one of my members:
"On threads where there are unread posts, can we get the little piece of paper on the top left corner of each post to be highlighted? It would be nice to have some clear visual distinction between read and unread without checking the time."

If I figure out what part of code decides if a post is "new" or "old", I could probably put in an if statement that changes the icon to a new highlighted one, but I have no idea where this code would be located.

-Another request by a member:
"When you choose to add someone as a friend, it asks you if you want to send them a friend request, in addition to saving their contact information. I feel that this is unnecessary, as everyone's intentions were probably to send them a friend request in the first place. Is it possible to just skip this and just send a request to the person without having to click that extra button?"
If someone could tell me which file to dig through I'm sure I could figure the rest of this one out on my own

-One member asked for more noticeable notifications. I think https://vborg.vbsupport.ru/showthread.php?t=232032 would be great for the member, but most members would prefer it the way it is now. How can I add this as an option in site display options so that some members can have one style and others can use the new one?

That's all I can think of right now. I'll update with more as I think of them!
Reply With Quote
  #2  
Old 11-07-2010, 08:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

- doing a search in phrases for the too short message gives me the error phrase "tooshort" Doing a search through the files for that phrase gives me a list of 8 files (actually more, but results for "usernametooshort" came up also)you would have to edit to modify the action. Hopefully you have an editor that will allow you to search all files in a directory and then you will get them all.

- there is a View First Unread button on the top of the thread that takes you right to the first unread post. Isn't that what he wants?

- can't do it with just a link. You need to modify the code. Look at the form actionrofile.php?do=doaddlist&list=&userid=2 That should tell you were to look.

- You can offer different styles to users. So, an easy way is to have one style with one type of notification, the other with the original.
Reply With Quote
  #3  
Old 11-07-2010, 08:34 PM
NovoCiv NovoCiv is offline
 
Join Date: Aug 2010
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

-I'm not sure how to search for specific files. My webhost is justhost and I use their filemanager, so all I can do is search filenames. I'll keep an eye out for tooshort, but I'm still unsure as to how I should go about this.

-I'll mention that and see if that's enough.

-I don't understand? I don't really know php, I've just sort of taught myself what to do by looking at the code and figuring out how it works (a semester of java helped me get the idea of how things work). I don't know how to look at forms and the ?do= thing has always been frustrating because I can't figure out how to get to the things related to it.

This reminds me, I wanted to set up a code that posts new threads when we submit an item to the main website's database. I figured it would be easy by just looking at how reports/infractions are auto-posted, but I couldn't locate the code for these because it was one of those ?do= things. It's not needed anymore because we compromised with new threads being submitted to the front page database, but it would be nice to know for future ideas.

-That would be easy in some situations, but I already have to modify our three templates every time I change something. I don't want to add a fourth just for this, as there are a lot of template modifications. (Such as limiting what guests can view like memberlist and activity).

Thanks for the quick response!
Reply With Quote
  #4  
Old 11-07-2010, 08:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

- don't you use a text editor to edit your files? I use BBEdit and I can search for terms in a directory. I can't imagine how anybody who codes can do without that feature.

- look at profile.php and go to where it says 'do' is doaddlist - around line 619. That is where the code is to add the user. Actually, if you want a one-click solution, the link in the member page goes directly to do=addlist which is around line 454, so perhaps that is where you want to start.

- Make it a child style with just those couple of templates changed. That really is the easiest way to do this. (Or else probably write a few plugins to render some other templates you'd have to create and replace the main templates with the new ones if they chose to use notification style b, but like I said, the two separate style solution is going to be easier.)
Reply With Quote
  #5  
Old 11-07-2010, 09:08 PM
NovoCiv NovoCiv is offline
 
Join Date: Aug 2010
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

-Like I said, I just find the files in filemanager and edit them from there. I can't search for words in other files, just titles of files and searching once I open a file. Is there a guide I can read to show me how to do things more efficiently? I basically opened the public_html in filemanager, went into the forum folder, and then mess around with the php files.

-I'll look into that and see what happens.

-I'll look into child styles, but I really would prefer having a checkbox in forum display options for the bigger notifications. Like, right next to "show images".

The member was glad with the information about new posts!

Thanks again for helping me.
Reply With Quote
  #6  
Old 11-07-2010, 10:11 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

- Not really. I'm saying from experience that if you are going to get into coding, it really helps to be able to search for a word in all files in a directory. You want to know whenever that phrase comes up and you want to do something instead. How else will you find all instances you have to change - by just opening up all files and doing a search in that particular file? If you want to just open up the files and search for the code, then that is fine. I know there are other users who do it that way. But, personally, I would not be able to use that method. I would not be able to guess every file I would have to look at and I'm not a new user to vbulletin.

- I suppose you could create a Custom Profile Fields and then put a condition in all those templates - if fieldx == 'yes', show this code, else show that code, type of thing. You can try that on your test site and see how that works out.
Reply With Quote
  #7  
Old 11-08-2010, 09:57 AM
Retal Retal is offline
 
Join Date: Nov 2006
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Apart from using an editor or IDE as Lynne is suggesting you're preparing a hell of work and mistakes for yourself when you want to upgrade vBulletin.

Instead of editing the files directly find the hook nearest to the place you want to do damage and use it to create a plugin (= a PHP code that's run on the hook line).
Reply With Quote
  #8  
Old 11-15-2010, 06:30 PM
NovoCiv NovoCiv is offline
 
Join Date: Aug 2010
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry for the delayed response. I've been away on personal business. Unfortunately the development administrator has not looked into this yet (I'm nowhere near as proficient as him, I focus more on running the site and PR type stuff).

I still feel completely lost on allowing blankposting. I looked into BBEdit and it looks to be mac only. I'm on a PC, are there any alternatives?

Quote:
Originally Posted by Retal View Post
Apart from using an editor or IDE as Lynne is suggesting you're preparing a hell of work and mistakes for yourself when you want to upgrade vBulletin.

Instead of editing the files directly find the hook nearest to the place you want to do damage and use it to create a plugin (= a PHP code that's run on the hook line).
I don't really understand any of your post. I have already changed around so much in my files that I don't intend to upgrade vBulletin. Upgrading would no doubt break a lot of things that we've done.


Edit: One more slight issue we've run into. For certain things (such as hide tags and QR images) we have noticed that hidden content can be found by quoting a post. I've narrowed it down to the newpost_quote template, and in styles where I remove the {vb:raw pagetext} from the template the vulnerability is removed (at the cost of quoting). I think the best solution would just be to add some command in the code to parse all BB code. I just don't know enough PHP to know what command to use. Here's an example of what I mean (I know parsebbcode() isn't real).
Code:
ORIGINAL:
[QUOTE={vb:raw originalposter}]{vb:raw pagetext}[/QUOTE]
FIX:
[QUOTE={vb:raw originalposter}]parsebbcode({vb:raw pagetext})[/QUOTE]
Reply With Quote
  #9  
Old 11-23-2010, 04:15 AM
NovoCiv NovoCiv is offline
 
Join Date: Aug 2010
Posts: 80
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't understand why people have stopped helping me :/
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:18 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07769 seconds
  • Memory Usage 2,248KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete