![]() |
BB Code Functions
http://www.animesystem.com/temp/bbcf1.0.jpg
As requested by mudpyr8: https://vborg.vbsupport.ru/showthread.php?t=62933 Features
Known bugs
Notes
Screenshots See attachments. Enjoy. Remember to click install if you do use this hack. ;) |
Have a custom function that is useful?
Just send me a link to a file with the function, or PM me the working code, and I'll display it in this post. 1. Evaluate mathematical expression Here is a useful function that will take a mathematical expression and return the answer for it. Valid operators include plus + minus - multiply * divide / modulus % carrot/power ^ and parentheses (). When used in BB Code, have one argument and it should function like so: [math]5*6%3+((45/5)/4)[/math] 5*6%3 = 0 (45/5)/4 = 2.25 = 2.25 Here is the function: PHP Code:
|
Sorry to sound so deft here, but what does this actually do and how would we use it?
Also, I have to know. How did you do that with that screenshot at the top of the post? That is wild. ;) |
Sorry to sound so deft here, but what does this actually do and how would we use it?
|
Quote:
ditto LOL im confused as well |
Quote:
|
This is amazing, but some of them are too hardcored, may be I will use some of them.
See Ya |
I thought the attached screenshots would be enough of an explanation.
This hack allows you to give bb code PHP functions (internal or custom). For example, if I assigned the PHP function rand() to a tag called [rand], it would generate a random value. [rand="0"]100[/rand] Would generate a random value from 0 - 100. |
This looks great - could be used to resize an image right? And all sorts ....
Btw love that image at the top ;) |
Quote:
|
Quote:
Quote:
Quote:
|
So..
If anyone has this installed and working, could you let me know? It's a sort of long (although quick) hack to install, so I just want to confirm everything is in place. ;) |
Wow, kickass hack. I won't install it just yet (trying to find a good file comparison program for Linux to upgrade to vB3 Gold - and I'm not digging myself into a bigger hole before I upgrade (31 modified files is enough for RC3, thank you very much) ;) Well definately install it when I finally get vB3 Gold up and running. :)
[high]* Link14716 clicks install anyways. :)[/high] |
The following is a useful function I made that evaluates a mathematical expression.
https://vborg.vbsupport.ru/showpost....02&postcount=2 |
Quote:
|
Quote:
|
Big kudos to VeloCD for doing this hack. He was willing to write the code after an initial request I made for my dice roller. I like to have the ability for members to roll dice in my forums, but I didn't want to have to hack up the bbcode parser to do it. I thought it would be great to have an adminCP that would allow for php functions to be called by bbcodes, but had NO idea how to do it.
Luckily VeloCD saw my post and said he knew how to do it and here it is. BIG BIG THANKS. I will be posting my dice roller soon. If you'd like to see it in action, here you go: http://www.tekhed.com/dice/ Feel free to email me with game system support requests. |
I'm going to have to add a line of credit to my site just to cover you Velocd. I don't go looking for your hacks specifically, but it seems you're often behind the ones I end up on when I have a focused need. Great work, again.
Now that I've blown a little sunshine, I have a "clueless" question to ask. I need to figure out some method of allowing users to make text in their post 'secure'. 'Secure' in the sense that other users can't just highlight, right click, copy, and then paste elsewhere. I know nothing is entirely safe (they could simply just View Source), but the primary goal is to prevent someone from absentmindedly cutting and pasting something sensitive into an email to someone else. I could just do it for all my pages, but in many cases the content my site covers needs to be able to be copied and pasted into other posts, so that's no good. Needs to be only there when people want it so. I've found JavaScript that can accomplish this (I'll quote below in case this is a bad way to do it (it did come from someone named Bart with an AOL account after all), and someone can recommend better -- or in case I haven't expressed my desire well enough), but no PHP. PHP *seems* to be what your hack speaks to though. So my question, and it's coming from a layman to be sure, is can I accomplish what I want with your hack? HTML Code:
<SCRIPT language=JavaScript> |
One control that might be necessary is the ability to prohibit the use of a particular code in a signature. BBCodes are normally allowed in signatures, but someone who puts [power] into their sig, or [roll]50d1000[/roll] could generate a lot of server activity. If this isn't possible, the admin will just have to watch for such sigs, but it is important to note that. 100 people with factorials in their sigs is gonna be bad.
|
wcbryant: I think you can. You would just have to write a php function that wraps the bbcode param in the javascript:
[secure]insert message here[/secure] would then wrap "insert message here" in the javascript. |
wcbryant, I understand what you're trying to do, but I don't think this hack serves the purpose. (unless my interpretation is wrong, and mudpyr8 is closer to your question)
Quote:
I will look into disabling it for signatures, as well fixing that bug, over the weekend. ;) |
Quote:
You can turn off 'email to a friend' or 'printer friendly format' in threads, all I want to be able to do is turn off user's ability to copy and paste. Disable text highlighting (not that I think the JS I found does that), and disable right clicking. Again, I understand people can always just view source, but my goal is the prevention of accidental leaks, rather than intentional/malicious ones. Anyway, thanks to you both for the responses. |
VeloCD, thanks. I got it working and it is superb. A couple of things:
1. In your install notes, steps 49 & 50 refer to 'allowsmilie". It should be 'allowsmilies'. 2. It reevaluates on edit of the message. It would be nice if this could be disabled. For my dice roller, I only want it to roll once. Not a big deal since when rolling dice it is a faux pas to edit your post anyway. 3. It only accepts one instance of the code (the last one). If I put two [roll] tags in one message, it only evaluates the last one. Again, thanks a lot. This rocks. |
1. Thanks, will correct. ;)
2. If you are using the WYSIWYG editor and have the update option disabled, it shouldn't do so, since the return value of the function is hard-coded into the post. But, I haven't had time to look into making the update work for non-WYSIWYG. 3. That's odd. I'll check this out, although it should evaluate all tags. If you place two custom BB Code function tags that aren't your roll function, say maybe [random], does this generate two random values? |
I have installed this hack so far since I was looking for something that enables me to use php functions in bbcodes...
But I'm fiddling around and it's not working.... Here's the function to include: PHP Code:
Title: countdown Handle: fetch_countdown_timer Include File: countdown.php (containing above code) Also I added a bbcode 'countdown' and have choosen the function in there.... It's just not working, what am I doing wrong? As an example I used [countdown]03, July 2004[/countdown] and the function returns something like -13h -40m instead of 11d and something.... How do I pass the date of interest to the function? |
sorry for double posting but I didn't want to edit in case someone read my previous posting and wouldn't recognize this posting then.
I think I found out what's going wrong, it's because If I'm trying to pass a date it will be passed as Unix Timestamp. Is there any way to pass the variable to the function as formatted date? |
^bump^
|
it would be perfect to have a countdown timer intergrated with the calendar. =)
|
OK, I'm those of those guys that hated math classes in school.... besides the mathematical functions, what are some other uses that you guys have come up with?
|
From the description...this hack is the King!
Installing and testing tomorrow. |
After the upgrade to 3.03 I had to re-install this hack and, as an outcome, here are the instructions for the countdown:
Install the hack Add the following code to includes/functions.php: Code:
// ###################### Start fetch_countdown_timer ###################### title: countdown handle: fetch_countdown_timer description: whatever you want include file: [leave blank] Update upon page refresh?: yes Then create a custom bb code: title: countdown tag: countdown function: countdown replacement: [leave blank] example: [countdown]1088859600[/countdown] (choose any unix timestamp here) description: [whatever you want] use parameter: no button image: [any image you want] Now, to make this usable to your users: Add a link to a calculation script like this one (I did this on the editor toolbars): http://www.php4scripte.de/umrechner/ it converts a real time into a unix timestamp which can then be used within the BB Code. I'd really appreciate if one could help me to avoid the conversion between realtime and unix timestamp... so the function can work with realtime formats |
I just tried to add a new cutom bbcode to our forums - well, that worked - but the new created code won't show up in the bbcode manager.
I edited all the files, according to the install.html, once again - with no effect at all. Any help on what's wrong here? Can anyone, who has this hack properly installed, send me this three files: bbcode.php adminfunctions.php functions_bbcodeparse.php ?? Send them to sven@cncforen.de |
Does anyone yet know if this hack is compatiable with .5? It looks like a great hack, but I don't want to install it if it won't work yet, or will cause errors.
|
I need Flash BB code, can anyone here help me?
I need to import flash in to my forum but I dont know how to do that. Thanks. |
Hey. I'm trying to get this hack installed, but I don't understand how to run the queries from PHPMyAdmin. I go to my database, select Querey, but I don't know where to enter it. Entering it in the box labeled "SQL-query on database tcmutt_Source" just gives me the error "You have to choose at least one Column to display". =/ Can anyone tell me what I'm doing wrong?
EDIT: Whoops. My mistake. I think I found out where to do it. EDIT2: Alright, it's installed correctly now. Thanks for making this, it should prove very useful. :D |
Are the instructions for installation still valid with 3.0.7?
|
Quote:
|
Well, I did everything the instructions said and I got an error, so backed it all out.
The error was in the functions_bbcodeparse file. The error message was "unexpected $ at line 1767" (which is the line with the ?>). I have checked all the hacks and they seem correct. Here is the final code you can find all the changes and the step numbers by finding "SMJU001" I tried pasting the code in here BUT it made the message too big. Thus you can find it [Removed by moderator]** Here ** |
Quote:
|
Whoops.
Consider it removed. How then do I get help, because I am convinced that I made the hack changes correctly. |
All times are GMT. The time now is 05:17 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|