vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   newbie with lots of newbie questions! (https://vborg.vbsupport.ru/showthread.php?t=234252)

White_Snake 01-26-2010 10:44 PM

newbie with lots of newbie questions!
 
hello!

i been studing some basic php stuff and now im open to take the challenge to learn how does vbulletin works, so far i been checking random php files on vbulletin base files and some plugins from modifications, and i have the following questions which i havent been able to solve by myself:
  • what does this->registry->options[] means/contains? i know this-> its part of classes on php, but, im not sure how does the whole thing works on vbulletin
  • how does vbulletin->GPC and vbulletin->input->clean_array_gpc works? its the same as on vbulletin 3 documentation?
  • i need to use "Send PM" automatically functions, i have found a vbulletin 3 article on this but, i suppose its obsolete on vb4, i have tried to find how to do this by examinating private.php on vb4 and i havent had any luck, any suggestions?
  • is the $db-> fuction list is the same as vb3?

thanks in advance for your time and replies :)

Lynne 01-26-2010 11:58 PM

- Hmmm, I'm not a php guru, but there are some functions that require you to use $this->registry->posts or $this->registry->options instead of just $posts or $vbulletin->options. The best thing to figure out which to use is to locate the hook you are wanting to use in the php code and see the syntax used right there.

- information regarding the input cleaner is still valid for vB4

- I don't know anything about the send PM article, sorry

- $db should all be the same. If you are writing code for the CMS however, the syntax will be a little different with a "vB::" in front of it.

White_Snake 01-27-2010 02:41 AM

Quote:

Originally Posted by Lynne (Post 1967539)
- Hmmm, I'm not a php guru, but there are some functions that require you to use $this->registry->posts or $this->registry->options instead of just $posts or $vbulletin->options. The best thing to figure out which to use is to locate the hook you are wanting to use in the php code and see the syntax used right there.

- information regarding the input cleaner is still valid for vB4

- I don't know anything about the send PM article, sorry

- $db should all be the same. If you are writing code for the CMS however, the syntax will be a little different with a "vB::" in front of it.

hello Lynne!

thanks a lot for your answers :) now i hope someone else can help me with the PM bit, in the meanwhile ill check the rest of the stuff you commented, thanks again!

BBR-APBT 01-27-2010 03:05 AM

Have you tried using that code? It seems as it should still work. If you have any specific questions regarding a error with that code you have posted feel to post with a specific question.

I can not start to help you when you have not even tried to use that code thus have no real question as of yet.

White_Snake 01-27-2010 03:14 AM

Quote:

Originally Posted by BBR-APBT (Post 1967627)
Have you tried using that code? It seems as it should still work. If you have any specific questions regarding a error with that code you have posted feel to post with a specific question.

I can not start to help you when you have not even tried to use that code thus have no real question as of yet.

thanks for your reply!

i just havent tried it because im not sure which part is the correct one but i suppose its time to start poking around, vbulletin its a *HUGE* script and its hard for a php green rookie like me to find the right direction, but ill start checking files and see what i can come up with thanks!

BBR-APBT 01-27-2010 03:22 AM

You would use plugins. If you want it to send a welcome message you would use a hook like register_addmember_complete. Then when the user finishes registering it would call up the code you just put in the plugin. So if you put that code for the private message in there it would send the message when they finished.

You should set up a test board so that it is on a password protected directory. This way you can do all your testing there and not worry about breaking your live site.

White_Snake 01-27-2010 07:14 PM

Quote:

Originally Posted by BBR-APBT (Post 1967634)
You would use plugins. If you want it to send a welcome message you would use a hook like register_addmember_complete. Then when the user finishes registering it would call up the code you just put in the plugin. So if you put that code for the private message in there it would send the message when they finished.

You should set up a test board so that it is on a password protected directory. This way you can do all your testing there and not worry about breaking your live site.


im running a test board already, i have done some other modifications, what exactly i want to do is to make a modification where the user receives a notification once he makes 50 posts, i have already the full code working in the right hook which is postbit_display_complete but, the only element im missing here is the function or class vbulletin uses to send a PM which i can run everytime a user hits the 50 post mark :)

BBR-APBT 01-27-2010 07:16 PM

Quote:

Originally Posted by White_Snake (Post 1968270)
im running a test board already, i have done some other modifications, what exactly i want to do is to make a modification where the user receives a notification once he makes 50 posts, i have already the full code working in the right hook which is postbit_display_complete but, the only element im missing here is the function or class vbulletin uses to send a PM which i can run everytime a user hits the 50 post mark :)

That is what the code you linked to. That is what you need.

White_Snake 01-27-2010 08:17 PM

Quote:

Originally Posted by BBR-APBT (Post 1968272)
That is what the code you linked to. That is what you need.

i checked both classes on vb3 and vb4 and they are identical, im gonna play around with it for a while, thanks!

--------------- Added [DATE]1264633171[/DATE] at [TIME]1264633171[/TIME] ---------------

okay i tried it out and it works nicely except for one issue, the constant TIMENOW on vb3 is not working anymore on vb4 so i need to find its equivalent

--------------- Added [DATE]1264640546[/DATE] at [TIME]1264640546[/TIME] ---------------

nevermind the timenow issue, it was a mistake on my side, the issue im having is that the internal vbulletin arrays arent working in the plugin, this is my code:

PHP Code:

$pmdm =& datamanager_init('PM'$vbulletinERRTYPE_ARRAY); 
        
$pmdm->set('fromuserid'1); 
        
$pmdm->set('fromusername'Admin); 
        
$pmdm->set('title''congratulations'); 
        
$pmdm->set('message'"congratulations $vbulletin->userinfo['username'] you have made your 50th post, we're all so prod of you keep on posting"); 
        
$pmdm->set_recipients('$vbulletin->userinfo['username']'$permissions); 
        
$pmdm->set('dateline'TIMENOW); 
    
        
$pmdm->save(); 

if i directly write a username on the set_recipients instead of $vbulletin->userinfo['username'] the PM works perfectly, but if i use it, the PM is not sent, as well, if i use $vbulletin->userinfo['username'] in the message, i get: Array['username'] in the output instead of the nick of the user receiving the PM

thanks again for any help :)

BBR-APBT 01-27-2010 11:45 PM

This line
Code:

        $pmdm->set_recipients('$vbulletin->userinfo['username']', $permissions);
would be
Code:

        $pmdm->set_recipients($vbulletin->userinfo['username'], $permissions);


All times are GMT. The time now is 10:02 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.01184 seconds
  • Memory Usage 1,759KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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