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

Reply
 
Thread Tools Display Modes
  #11  
Old 01-28-2010, 01:43 AM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BBR-APBT View Post
This line
Code:
        $pmdm->set_recipients('$vbulletin->userinfo['username']', $permissions);
would be
Code:
        $pmdm->set_recipients($vbulletin->userinfo['username'], $permissions);
that did the trick, any suggestion on parsing the code inside the pm message area?
Reply With Quote
  #12  
Old 01-28-2010, 02:36 AM
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Location: Maryland
Posts: 946
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by White_Snake View Post
that did the trick, any suggestion on parsing the code inside the pm message area?
What do you mean parsing the code in the message area?

You mean like the user name?
Reply With Quote
  #13  
Old 01-28-2010, 03:57 AM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BBR-APBT View Post
What do you mean parsing the code in the message area?

You mean like the user name?
my apologies, i should have been more clear with my question
this is what i mean:

PHP Code:
$pmdm->set('message'"congratulations $vbulletin->userinfo['username'] you have made your 50th post, we're all so prod of you keep on posting"); 
that line gives me the following output:

HTML Code:
congratulations Array['username'] you have made your 50th post, we're all so prod of you keep on posting
Reply With Quote
  #14  
Old 01-28-2010, 04:27 AM
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Location: Maryland
Posts: 946
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by White_Snake View Post
my apologies, i should have been more clear with my question
this is what i mean:

PHP Code:
$pmdm->set('message'"congratulations $vbulletin->userinfo['username'] you have made your 50th post, we're all so prod of you keep on posting"); 
that line gives me the following output:

HTML Code:
congratulations Array['username'] you have made your 50th post, we're all so prod of you keep on posting
Code:
$50postusername = $vbulletin->userinfo['username']
$pmdm->set('message', "congratulations $50postusername you have made your 50th post, we're all so prod of you keep on posting");

it may even be
Code:
$50postusername = $vbulletin->userinfo['username']
$pmdm->set('message', "congratulations " .  $50postusername  . " you have made your 50th post, we're all so prod of you keep on posting");
Reply With Quote
  #15  
Old 01-28-2010, 04:22 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BBR-APBT View Post
Code:
$50postusername = $vbulletin->userinfo['username']
$pmdm->set('message', "congratulations $50postusername you have made your 50th post, we're all so prod of you keep on posting");

it may even be
Code:
$50postusername = $vbulletin->userinfo['username']
$pmdm->set('message', "congratulations " .  $50postusername  . " you have made your 50th post, we're all so prod of you keep on posting");
thank you!

but apparently using the line " $50postusername = $vbulletin->userinfo['username']; " makes the script to stop working, and i have tried with both possibilities you have posted in here, the one with the joined strings and the one with the direct variable this is my full code:

PHP Code:
if ($foruminfo['countposts'] AND $vbulletin->userinfo['posts'] + == 50) {
$
50postusername $vbulletin->userinfo['username']; 
$pmdm =& datamanager_init('PM'$vbulletinERRTYPE_ARRAY); 
        
$pmdm->set('fromuserid'1); 
        
$pmdm->set('fromusername'Administrator); 
        
$pmdm->set('title''Congratulations');
        
$pmdm->set('message'"congratulations $50postusername 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->pre_save(); 
    
        
// process errors if there are any 
        
$errors array_merge($errors$pmdm->errors); 
    
        if (!empty(
$errors)) 
        { 
                
$errorlist ''
                foreach (
$pmdm->errors AS $index => $error
                { 
                    
$errorlist .= "<li>$error</li>"
                } 
        } 
        else 
        { 
            
// everything's good! 
            
$pmdm->save(); 
        } 

im using the $pmdm->error() function too and its not giving me any error, its almost as if the script was dying because of the extra variable im setting in before reaching the end
Reply With Quote
  #16  
Old 01-29-2010, 07:26 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i tried my code in a separate .php file where i called global.php, then i pasted this code (without the IF statement) and it worked pefectly, the PM was sent correctly without any issue, by some odd reason, just by using any extra variable in the plugin, the code doesnt works at all such as $50postusername, id appreciate if someone can help me with this!
Reply With Quote
  #17  
Old 01-29-2010, 07:42 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try setting the $message first... ie:

Code:
$message = "congratulations......";
        $pmdm->set('message', $message);
Reply With Quote
  #18  
Old 01-29-2010, 07:53 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Try setting the $message first... ie:

Code:
$message = "congratulations......";
        $pmdm->set('message', $message);
same outcome, the script doesnt runs but thanks for the idea
Reply With Quote
  #19  
Old 01-29-2010, 10:25 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Let's see exactly what you did. It could be you wrote it incorrectly. And did you ever specific the hook location? You should tell us that information also.
Reply With Quote
  #20  
Old 01-29-2010, 10:42 PM
White_Snake's Avatar
White_Snake White_Snake is offline
 
Join Date: Jul 2005
Location: Guadalajara Mexico
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

okay, here goes the full plugin, with some extra stuff i added

hook location: newpost_complete

PHP Code:
if ($vbulletin->userinfo['referrerid'] > AND $foruminfo['countposts'] AND $vbulletin->userinfo['posts'] + == 50){
$ref_raw $db->query_read("SELECT username FROM user WHERE userid = ".$vbulletin->userinfo['referrerid']);
$ref_nam $db->fetch_array($ref_raw);

$pmdm =& datamanager_init('PM'$vbulletinERRTYPE_ARRAY);
        
$pmdm->set('fromuserid'1);
        
$pmdm->set('fromusername'Administrator);
        
$pmdm->set('title''Congratulations');
        
$pmdm->set('message'"congratulations! you have referred the user ".$vbulletin->userinfo['username']." and he has made 50 posts");
        
$pmdm->set_recipients($ref_nam['username'], $permissions);
        
$pmdm->set('dateline'TIMENOW);

        
$pmdm->pre_save();

        
// process errors if there are any
        
$errors = @array_merge($errors$pmdm->errors);

        if (!empty(
$errors))
        {
                
$errorlist '';
                foreach (
$pmdm->errors AS $index => $error)
                {
                    
$errorlist .= "<li>$error</li>";
                }
        }
        else
        {
            
// everything's good!
            
$pmdm->save();
        }

the weird part about this code is that i have tried it on a separate php file under the same directory as the forums that calls includes the file global.php and the whole thing works fine in that separated file, as well i tried to see if this hook had any conflict with others, so i disabled everything and still the problem persist

thanks!
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 06:21 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.10617 seconds
  • Memory Usage 2,308KB
  • 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
  • (8)bbcode_code
  • (2)bbcode_html
  • (4)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete