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

Reply
 
Thread Tools Display Modes
  #1  
Old 03-16-2021, 12:31 AM
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
Location: Montreal (Canada)
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default PM on Promotion

Hi,

I would be interested by this mod under vB3 (maybe vB5 too).

https://vborg.vbsupport.ru/showthread.php?t=140629

No problem for the install. Promotions are done with no error message but no PM is sent to the user. No PHP error in the logs too. Tested on default style.

I will retest later.

Regards
Reply With Quote
  #2  
Old 03-16-2021, 01:14 AM
TheLastBatman's Avatar
TheLastBatman TheLastBatman is offline
 
Join Date: Apr 2016
Location: Gotham
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not tested but in the install instructions change $pmdm =& datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY); to $pmdm = datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
Reply With Quote
  #3  
Old 03-16-2021, 01:55 AM
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
Location: Montreal (Canada)
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed the product again, replaced the line of code and tested the promotion...

This time as it is said in the last message of the topic, the cron job does not work, the promotion is not done automatically. No PM sent to the user again.


In the logs:
Code:
PHP Deprecated:  implode(): Passing glue string after array is deprecated. Swap the parameters in /home/.../public_html/.../includes/class_dm.php on line 810
PHP Fatal error:  <ul><li>blabla</ul>Unable to proceed with save while $errors array is not empty in class <strong>vB_DataManager_PM</strong> in /home/.../public_html/.../includes/class_dm.php on line 810
.
Reply With Quote
  #4  
Old 03-16-2021, 04:21 AM
TheLastBatman's Avatar
TheLastBatman TheLastBatman is offline
 
Join Date: Apr 2016
Location: Gotham
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Got it working

PHP Code:
$pmbody construct_phrase($vbphrase['sendpm_on_paid_promotion_primary_alertpm'], $promotion['username'], $promotion['title']);
                
$pmdm datamanager_init('PM'$vbulletinERRTYPE_SILENT);
                
$pmdm->set_info('is_automated'true);
                
$pmdm->set('fromuserid'$vbulletin->options['sendpm_on_promotion_fromuserid']);
                
$pmdm->set('fromusername'$vbulletin->options['sendpm_on_promotion_fromusername']);
                
$pmdm->set_info('receipt'false);
                
$pmdm->set_info('savecopy'false);
                
$pmdm->set('title'$vbulletin->options['sendpm_on_promotion_pm_subject']);
                
$pmdm->set('message'$pmbody);
                
$pmdm->set_recipients($promotion['username'], $pmpermissions);
                
$pmdm->set('dateline'TIMENOW);
        
$pmdm->set('allowsmilie'true);

                (
$hook vBulletinHook::fetch_hook('private_insertpm_process')) ? eval($hook) : false;

                
$pmdm->pre_save();
        if (empty(
$pmdm->errors))
                {
                    
$pmdm->save();
                    (
$hook vBulletinHook::fetch_hook('private_insertpm_complete')) ? eval($hook) : false;
                }
                unset(
$pmdm); 
Reply With Quote
  #5  
Old 03-16-2021, 09:57 AM
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
Location: Montreal (Canada)
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tested quickly by forcing promotions to 2 of my 11 usergroups and it works fine on PHP 7.4.x with no error message in the logs. I will restore my database and let the automatic promotion system go to see if it still works. I will give you some feedback but there is no reason that the automatic system does not work.

I only tested for the number of posts as a requirement for promotions. Do you think it will work if reputation is considered in promotions?

Anyway, I'll test that too before the feedback.

Thank you very much!
Reply With Quote
  #6  
Old 03-16-2021, 03:11 PM
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
Location: Montreal (Canada)
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, tested on a clean new install/restored database.

The mod works well by manually running the promotion, the PM is sent and received correctly by the user. Unfortunately it's not working automatically, it's listed, enabled and scheduled in the scheduled task but the PM is not sent and received by the user. No PHP error in the log.

I checked the scheduled task log, it's listed. See the Attach File.
Log Phrase: Usergroup: <strong>{1}</strong>{2}; Users: {3}<dfn>* = Primary Usergroup, % = Secondary Usergroup</dfn>

The other tasks seem to work normally, at least for the Thread Views task. I did not check for other tasks.

Maybe something needs to be fixed in cron.php or some other files.

Regards
Attached Images
File Type: png 2021-03-16_11-42-21.png (3.8 KB, 0 views)
Reply With Quote
  #7  
Old 03-16-2021, 08:05 PM
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
Location: Montreal (Canada)
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think I will use this mod by disabling the User Promotions cron on the list and manually running it once a day for example. It just remains to check if everything else is working properly.
Reply With Quote
  #8  
Old 03-16-2021, 10:38 PM
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

See if this helps...

Change this line:
PHP Code:
$pmbody construct_phrase($vbphrase['sendpm_on_paid_promotion_alertpm'], $promotion['username'], $promotion['title']); 


TO:
PHP Code:
$pmbody construct_phrase($vbphrase['sendpm_on_paid_promotion_primary_alertpm'], $promotion['username'], $promotion['title']); 
Reply With Quote
  #9  
Old 03-16-2021, 10:53 PM
lange's Avatar
lange lange is offline
 
Join Date: Apr 2003
Location: Montreal (Canada)
Posts: 282
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks

It's already included there

Tested this morning.
Reply With Quote
  #10  
Old 03-16-2021, 11:00 PM
TheLastBatman's Avatar
TheLastBatman TheLastBatman is offline
 
Join Date: Apr 2016
Location: Gotham
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah if the auto cron isnt running that may be an issue else were, I had a member on my site report they never received a registration verification email either, so there may be a hick-up in the php 7.4 version.
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 05:56 PM.


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.04202 seconds
  • Memory Usage 2,294KB
  • Queries Executed 12 (?)
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
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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
  • (1)postbit_attachment
  • (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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete