vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Creating vB modifications for beginners (https://vborg.vbsupport.ru/showthread.php?t=213973)

HardForum 05-18-2009 12:09 PM

Creating vB modifications for beginners
 
Where can I read about it? All that I found is unreadable for beginners
For example, I want to create a hack, that will add a new line in user column (postbit) with some text.

Almotmaiz.Net 05-18-2009 02:08 PM

first u need to enable debug mood on uer test forum.
after.. creat a product from add/upload.

then add your options/ tempates/ plugins
and make sure you select your product name.

sorry for my bad english

powerful_rogue 05-18-2009 02:11 PM

Im also at the stage where I want to start putting my ideas into practice.

Im on the w3schools.com website, any ideas where I should start? Im guessing the following but i maybe wrong!

HTML
XML
Javascript
PHP
SQL

Once these have been studied, is it difficult to put them into practice is vbulletin?

How long did it take for you to get to grips and write your first mod?

Lynne 05-18-2009 02:20 PM

The best thing to do is find a similar modification and see how they went about it. Actually, if possible, grab a couple of similar ones by different authors to see their methods.

And, you can always post your code in the Programming forum and tell us the problem you are having and we can try to help you solve it.

powerful_rogue 05-18-2009 02:27 PM

Hi Lynne,

Thats what ive been trying to do, however without any luck! The mod I want to create is when a member increases in rank they get a message pop up on their screen.

Theres a simlar mod created which sends a PM, so ive been trying to look out how to change it from sending a PM to sending a popup - but without much luck at the moment!

EnIgMa1234 05-18-2009 02:35 PM

I've found that the best way is to start out with something simple and work your way up.

powerful_rogue 05-18-2009 02:37 PM

Thanks. By that would you say the mod im looking to create is a bit too complex for a beginner?

EnIgMa1234 05-18-2009 02:38 PM

Quote:

Originally Posted by powerful_rogue (Post 1812949)
Thanks. By that would you say the mod im looking to create is a bit too complex for a beginner?

It really just depends on your experience coding.

Lynne 05-18-2009 03:20 PM

Doing a pop-up is javascript. So, you'd want to use the same trigger they use in the modification you downloaded, but you'd need to add some javascript to the template when the promotion happens. That could be a bit difficult for a beginner if you are unfamiliar with how to add javascript to a page (you can google "javascript pop-up" and I'm sure you'd get the code).

powerful_rogue 05-18-2009 03:25 PM

Hi Lynne,

I was reading p on javascript the other day, especially use of the pop up box. The only problem is the mod I was going to try and alter does not use any templates, so I would be unsure of where I would need to add the code.

https://vborg.vbsupport.ru/showthrea...highlight=rank

Lynne 05-18-2009 03:55 PM

That would be part of what you would have to add to the mod. You'd probably set a variable which would then turn 'on' the code in the template to make the pop-up. Or something like that.

powerful_rogue 05-19-2009 06:38 AM

Lynne, This will probably sound like a really stupid question, but im sure it will help me on the right track!

Why would I need to create a template? I thought templates were only used for showing something - SHOWTHREAD, FORUMHOME etc

If you put some code in the SHOWTHREAD, it only works when you visit the SHOWTHREAD page, likewise for other templates. I would have thought the code would need to go in the header/footer or template which show on every page?

Im probably wrong in my logic, but this is a great time to get these mistaken thoughts sorted!

HMBeaty 05-19-2009 06:47 AM

You can also read up on all of these. It helped me out alot

Dismounted 05-19-2009 07:02 AM

Quote:

Originally Posted by powerful_rogue (Post 1812931)
Im on the w3schools.com website, any ideas where I should start? Im guessing the following but i maybe wrong!

HTML
XML
Javascript
PHP
SQL

You don't really need XML knowledge unless you're dealing with vBulletin's AJAX, but yes, that's the stuff you'd want to learn.

powerful_rogue 05-19-2009 07:31 AM

Thank you everyone. :)

Lynne, I think we must have had our wires crossed as I now know what you mean! originally I was talking more along the lines of an alert box, however now you mentioned templates Im presuming your talking about an actual pop up window!

Ive just started to have a little play and come across a problem. Ive put the following code into the headinclude template

PHP Code:

<if condition="$post['postcount'] = '5'">
<
script language="JavaScript" type="text/javascript">
window.open("win1.html","Window1",
"menubar=no,width=430,height=360,toolbar=no");
</
script></if> 

However it seems to disregard the =5. Ive got a post count on my test forum of 2000+ and it still shows the pop up.

Ive also tried <5 (less then 5) and yet it still shows, but if I change it to >5 (greater then) it dosent show :confused:

Im going to get some sleep as just come off a night shift, then a trip down to the library to get some books out! Ive tried once before to learn, but gave up because I started to get confused, but Im more determined then anything now! I think im going to struggle when it comes to adding fields in the admincp to control the mod, but one step at a time!

EnIgMa1234 05-19-2009 02:44 PM

Quote:

Originally Posted by powerful_rogue (Post 1813333)
Thank you everyone. :)

Lynne, I think we must have had our wires crossed as I now know what you mean! originally I was talking more along the lines of an alert box, however now you mentioned templates Im presuming your talking about an actual pop up window!

Ive just started to have a little play and come across a problem. Ive put the following code into the headinclude template

PHP Code:

<if condition="$post['postcount'] = '5'">
<
script language="JavaScript" type="text/javascript">
window.open("win1.html","Window1",
"menubar=no,width=430,height=360,toolbar=no");
</
script></if> 

However it seems to disregard the =5. Ive got a post count on my test forum of 2000+ and it still shows the pop up.

Ive also tried <5 (less then 5) and yet it still shows, but if I change it to >5 (greater then) it dosent show :confused:

Im going to get some sleep as just come off a night shift, then a trip down to the library to get some books out! Ive tried once before to learn, but gave up because I started to get confused, but Im more determined then anything now! I think im going to struggle when it comes to adding fields in the admincp to control the mod, but one step at a time!

Change the = to ==.

= is for setting a value to something,
== is for comparison

Lynne 05-19-2009 03:16 PM

Yep, what he said. ^^

powerful_rogue 05-19-2009 04:30 PM

Brilliant stuff! Thank you!

Any idea why the below dosent work even though my postcount is greater then 5?

Quote:

<if condition="$post['postcount'] > '5'">
<script language="JavaScript" type="text/javascript">
window.open("win1.html","Window1",
"menubar=no,width=430,height=360,toolbar=no");
</script></if>
however it shows up when I chage it to less then?

Quote:

<if condition="$post['postcount'] < '5'">
<script language="JavaScript" type="text/javascript">
window.open("win1.html","Window1",
"menubar=no,width=430,height=360,toolbar=no");
</script></if>

EnIgMa1234 05-19-2009 06:22 PM

Quote:

Originally Posted by powerful_rogue (Post 1813571)
Brilliant stuff! Thank you!

Any idea why the below dosent work even though my postcount is greater then 5?



however it shows up when I chage it to less then?

You'll need to use $post[posts]

If you want the current users info and not what ever user posted use this:

Code:

$bbuserinfo[posts]

Dismounted 05-20-2009 05:55 AM

You can't do that - "posts" is (most of the time) an already formatted value (i.e. "1,000" instead of "1000"), and therefore, number comparisons will fail.

powerful_rogue 05-20-2009 09:04 AM

Thanks everyone.

I found an old mod yesterday and started having a play around with it. I managed to update it slightly using javascript code from the intertnet, but then had to stop when features such as the one below stopped working and I couldnt get my head around the code to resolve it.

PHP Code:

if ($vbulletin->userinfo[lastactivity] > AND $vbulletin->userinfo[lastactivity] > mktime (date("H")-$vbulletin->options[dynamic_pop_freq], date("i"), date("s"), date("m"), date("d"), date("Y")))     //popup once in every XX hours 

I went to the library yesterday, but had no php/sql books in, so I got "Javascript for the World Wide Web"

Ive been trying to find out the best php/sql book to get. Ive had a search around and this book seems to come highly recommended. "Build you own database driven website using PHP and MySQL by Kevin Yank" Even one the coders of vbulletin was reading it back in 2002, so cant be that bad!

Just wondered if anyone else had any recommendations that helped them along and managed to code mods for vbulletin after.

One more quick question, once you have a basic understanding of php and mysql, is it difficult combining it with vbulletin?

Dismounted 05-20-2009 09:37 AM

Quote:

Originally Posted by powerful_rogue (Post 1813968)
One more quick question, once you have a basic understanding of php and mysql, is it difficult combining it with vbulletin?

To be honest, vBulletin requires more than a basic understanding of PHP, as the techniques it uses are not simple to understand. For example, most (if not all) learners are taught about using echo whenever they want to send output. In vBulletin, all the required information is generated and gathered before being passed off to templates, then outputted.

This is one of the many "differences" to "basic" PHP.

EnIgMa1234 05-20-2009 10:52 AM

Quote:

Originally Posted by powerful_rogue (Post 1813968)
PHP Code:

if ($vbulletin->userinfo[lastactivity] > AND $vbulletin->userinfo[lastactivity] > mktime (date("H")-$vbulletin->options[dynamic_pop_freq], date("i"), date("s"), date("m"), date("d"), date("Y")))     //popup once in every XX hours 


Split the code up into differant parts.

if ($vbulletin->userinfo['lastactivity] > 0

is like saying If the users last activity is greater than 0 seconds

AND $vbulletin->userinfo['lastactivity'] > mktime (...............))

and the users activity is greater than the result of mktime()
then...

If your not sure what the mktime function does, look it up on php.net

Its great to see you have a big interest in coding :)
Just remember not to give up and keep things simple.

powerful_rogue 05-22-2009 01:57 PM

Quote:

Originally Posted by Dismounted (Post 1813977)
To be honest, vBulletin requires more than a basic understanding of PHP, as the techniques it uses are not simple to understand. For example, most (if not all) learners are taught about using echo whenever they want to send output. In vBulletin, all the required information is generated and gathered before being passed off to templates, then outputted.

This is one of the many "differences" to "basic" PHP.

Apart from various articles on this forum, are you aware of any guides, documents from vbulletin which you would recommend reading to assist in learning how vbulletin works?

Quote:

Originally Posted by EnIgMa1234 (Post 1814010)
Split the code up into differant parts.

if ($vbulletin->userinfo['lastactivity] > 0

is like saying If the users last activity is greater than 0 seconds

AND $vbulletin->userinfo['lastactivity'] > mktime (...............))

and the users activity is greater than the result of mktime()
then...

If your not sure what the mktime function does, look it up on php.net

Its great to see you have a big interest in coding :)
Just remember not to give up and keep things simple.

Thank you :)
Its amazing the amount of ideas you come up with and then think "Thats too difficult at this stage" so your spot on with the "Keep it simple"

Im currently working my way through the javascript book. Some parts seem simple, other parts I have to keep reading over and over. Once I feel confident with that im then going to move onto php/mysql.

I'll get there one day!

EnIgMa1234 05-22-2009 03:18 PM

Quote:

Originally Posted by powerful_rogue (Post 1815201)
Apart from various articles on this forum, are you aware of any guides, documents from vbulletin which you would recommend reading to assist in learning how vbulletin works?



Thank you :)
Its amazing the amount of ideas you come up with and then think "Thats too difficult at this stage" so your spot on with the "Keep it simple"

Im currently working my way through the javascript book. Some parts seem simple, other parts I have to keep reading over and over. Once I feel confident with that im then going to move onto php/mysql.

I'll get there one day!

I'd start with PHP first if I was you. You'll use it most when creating mods. In most php tutorials, it teaches you SQL too (which is very easy).

powerful_rogue 05-22-2009 03:28 PM

Too late now! Javascript was the only book they had in the library when I went down! I must say im glad I got it. Im about half way through and got a grasp on most things. Ive got a week off so going to start having a play around with a simple banner mod I thought of.

THIS is the book im thinking of ordering, had some good reviews from what I can see. Did you start learning via books or did you learn everything online?

I must also say thank you. Its nice to see a coder reading through this section and helping out people who are just starting.

EnIgMa1234 05-22-2009 03:46 PM

Quote:

Originally Posted by powerful_rogue (Post 1815263)
Too late now! Javascript was the only book they had in the library when I went down! I must say im glad I got it. Im about half way through and got a grasp on most things. Ive got a week off so going to start having a play around with a simple banner mod I thought of.

THIS is the book im thinking of ordering, had some good reviews from what I can see. Did you start learning via books or did you learn everything online?

I must also say thank you. Its nice to see a coder reading through this section and helping out people who are just starting.

I just used online tutorials and look at other peoples code when I was starting out.

http://www.w3schools.com is a great site.

Go through the PHP tutorial there then create a test file and test a few functions.


All times are GMT. The time now is 03:51 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.01211 seconds
  • Memory Usage 1,830KB
  • 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
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (27)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete