[DBTech] DragonByte Credits

[DBTech] DragonByte Credits [Paid] 5.9.0

No permission to buy ($14.95)
DragonByte Tech updated [DBTech] DragonByte Credits with a new update entry:

5.3.2

Update highlights

This version fixes a performance problem with MySQL 5.6 and MariaDB 10.4, as well as introducing a few new minor features.

The description of a currency as set in the AdminCP is now displayed in the currency pop-up, above the tabs.

Lastly, it is now possible to link directly to a tab in the currency pop-up with a link such as /dbtech-credits/credits.1/?tab=purchase (if you have a Purchase event set up for that currency).


Complete...

Read the rest of this update entry...
 
DragonByte Tech updated [DBTech] DragonByte Credits with a new update entry:

5.4.0 Beta 1

Update highlights

This version features a major change to the way Thread and Post events work. The most frequent piece of feedback for DB Credits has always been "why do people lose credits when editing posts?" and the answer has always been "because of the 'amount per character' feature".

With this version, I aim to eliminate that confusion. The system will now look at the "Amount per character" / "Amount per word" setting for the Thread and Post events, and not apply any...

Read the rest of this update entry...
 
Unfortunately all threads are invisible now. They only show the thread title and nothing more, what can I do to fix this issue? :(

Looks like this was caused by an edit I did in the Thread.php file of xenforo:

Code:
    public function canReply(&$error = null)
    {
        //SBENNY START
        $visitor = \XF::visitor();
        
        $firstPost = $this->db()->fetchRow("
            SELECT post_id, post_date, user_id, username, reactions
            FROM xf_post
            WHERE thread_id = ?
            ORDER BY post_date
            LIMIT 1
        ", $this->thread_id);

        $this->first_post_id = $firstPost['post_id'];
        
        $purchase = \XF::db()->fetchRow('SELECT * FROM xf_dbtech_credits_charge_purchase WHERE user_id = ? AND post_id = ?', [$visitor->user_id, $this->first_post_id]);
        
        if ($purchase || $this->discussion_open && $visitor->user_id == $this->user_id)
        {
            return true;
        }

Disregard my message, thank you. I'll work on fixing it :)
 
Last edited:
Unfortunately all threads are invisible now. They only show the thread title and nothing more, what can I do to fix this issue? :(

Looks like this was caused by an edit I did in the Thread.php file of xenforo:

Code:
    public function canReply(&$error = null)
    {
        //SBENNY START
        $visitor = \XF::visitor();
       
        $firstPost = $this->db()->fetchRow("
            SELECT post_id, post_date, user_id, username, reactions
            FROM xf_post
            WHERE thread_id = ?
            ORDER BY post_date
            LIMIT 1
        ", $this->thread_id);

        $this->first_post_id = $firstPost['post_id'];
       
        $purchase = \XF::db()->fetchRow('SELECT * FROM xf_dbtech_credits_charge_purchase WHERE user_id = ? AND post_id = ?', [$visitor->user_id, $this->first_post_id]);
       
        if ($purchase || $this->discussion_open && $visitor->user_id == $this->user_id)
        {
            return true;
        }

Disregard my message, thank you. I'll work on fixing it :)
The xf_dbtech_credits_charge_purchase table has changed.

WHERE user_id = ? AND content_type = \'post\' AND content_id = ?
 
Exactly, my friend :) I panicked for nothing, sorry for bugging you, but I can see you're always so kind and helpful with me, I'm forever grateful. Looking forward to afford to support you even more in the near future :D
 
I have a question about this line:

"Furthermore, credits are no longer awarded for automated threads or posts."

What do you mean by automated threads or posts exactly? I noticed users don't get a reward anymore after posting a thread using Advanced Forms add-on, could this be the reason? Because I'd need to still award them for posting them, as it's something they manually do (unsure if it counts as "automated threads or posts").

I guess I should review "public function getApplicableEvents(\ArrayObject $extraParams, \XF\Entity\User $user, $refId, $negate = false)" inside src\addons\DBTech\Credits\EventTrigger\AbstractHandler.php, or possibly the "public function setIsAutomated()" in \src\addons\DBTech\Credits\XF\Service\Thread\Creator.php but I wouldn't want to cause a mess.

Thank you!

UPDATE:

This seems to have fixed the issue for me:

File: \src\addons\DBTech\Credits\XF\Service\Thread\Creator.php

Function (edited already):

public function setIsAutomated()
{
parent::setIsAutomated();

$this->postPreparer->setApplyDragonByteCreditsEvents(true);
}

Altough it might not be the ideal solution, for the moment I can live with it (having a few thousand new threads posted every day this was very urgent for me). Those who are not on a live (or big enough site) should wait for the awesome developer of this add-on first, as I cannot guarantee my change will fit your needs.
 
Last edited:
  • Like
Reactions: jul
What do you mean by automated threads or posts exactly? I noticed users don't get a reward anymore after posting a thread using Advanced Forms add-on, could this be the reason?
Yes, if that add-on sets the "is automated" flag then that is the issue. You should ask the developer of that add-on to change the behaviour (or make it optional) if you need it to work differently, as this change is necessary to avoid awarding credits for truly automated actions.
 
I'm not quite sure it's because of the add-on, but whenever I try to donate credits, it goes through without problems, but this error is logged in the server:

Code:
[LIST]
[*]ErrorException: Template error: Illegal string offset 'donate'
[*]internal_data/code_cache/templates/l1/s1/public/dbtech_credits_currency.php:79
[/LIST]
Stack trace
#0 internal_data/code_cache/templates/l1/s1/public/dbtech_credits_currency.php(79): XF\Template\Templater->handleTemplateError(2, 'Illegal string .....', 79, Array)
#1 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(Snog\Doodle\XF\Template\Templater), Array)
#2 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('dbtech_credits_...', Array)
#3 src/XF/Mvc/Renderer/Json.php(84): XF\Template\Template->render()
#4 src/XF/Mvc/Renderer/Json.php(68): XF\Mvc\Renderer\Json->renderHtmlFallback('DBTech\\Credits:...', 'public:dbtech_c...', Array)
#5 src/XF/Mvc/Dispatcher.php(418): XF\Mvc\Renderer\Json->renderView('DBTech\\Credits:...', 'public:dbtech_c...', Array)
#6 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#7 src/XF/Mvc/Dispatcher.php(360): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(53): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#9 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#10 src/XF.php(390): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}

Any ideas about what I should do to debug this error? I guess it's the dbtech_credits_currency template file, but my edits shouldn't affect the way it works, and the error started appearing after the last upgrade.

UPDATE

Looks like around line 36:

the previous:
<li class="{{ $tab.donate ? 'is-active' : '' }}"
caused the issue, while the following:
<li class="{{ $tab == 'donate' ? 'is-active' : '' }}"
fixed it.

Ok, disregard this then :)
 
Last edited:
I'm not quite sure it's because of the add-on, but whenever I try to donate credits, it goes through without problems, but this error is logged in the server:

Code:
[LIST]
[*]ErrorException: Template error: Illegal string offset 'donate'
[*]internal_data/code_cache/templates/l1/s1/public/dbtech_credits_currency.php:79
[/LIST]
Stack trace
#0 internal_data/code_cache/templates/l1/s1/public/dbtech_credits_currency.php(79): XF\Template\Templater->handleTemplateError(2, 'Illegal string .....', 79, Array)
#1 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(Snog\Doodle\XF\Template\Templater), Array)
#2 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('dbtech_credits_...', Array)
#3 src/XF/Mvc/Renderer/Json.php(84): XF\Template\Template->render()
#4 src/XF/Mvc/Renderer/Json.php(68): XF\Mvc\Renderer\Json->renderHtmlFallback('DBTech\\Credits:...', 'public:dbtech_c...', Array)
#5 src/XF/Mvc/Dispatcher.php(418): XF\Mvc\Renderer\Json->renderView('DBTech\\Credits:...', 'public:dbtech_c...', Array)
#6 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#7 src/XF/Mvc/Dispatcher.php(360): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(53): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#9 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#10 src/XF.php(390): XF\App->run()
#11 index.php(20): XF::runApp('XF\\Pub\\App')
#12 {main}

Any ideas about what I should do to debug this error? I guess it's the dbtech_credits_currency template file, but my edits shouldn't affect the way it works, and the error started appearing after the last upgrade.

UPDATE

Looks like around line 36:

the previous:
<li class="{{ $tab.donate ? 'is-active' : '' }}"
caused the issue, while the following:
<li class="{{ $tab == 'donate' ? 'is-active' : '' }}"
fixed it.

Ok, disregard this then :)
The template should have been marked as out of date if you had customised it prior to v5.4.0.
 
Forgot to confirm your previous version finally fixed the transactions issue with MariaDB (stuck at loading, tmp folder filled and mysql crash) and it's a big help, thanks again :)
 
Not at this time, sorry.
I got this error after upgrade to 5.3.2

Server Error Log
  • ErrorException: Template error: Illegal string offset 'richest'
  • internal_data/code_cache/templates/l2/s4/public/dbtech_credits_currency.php:209
  • Generated By: xxx
  • 4/11/19 at 01:16
Stack Trace
#0 internal_data/code_cache/templates/l2/s4/public/dbtech_credits_currency.php(209): XF\Template\Templater->handleTemplateError(2, 'Illegal string ...', '/home/xxx.co...', 209, Array)
#1 src/XF/Template/Templater.php(1315): XF\Template\Templater->{closure}(Object(ThemeHouse\UIX\XF\Template\Templater), Array)
#2 src/addons/BR/ModernStatistic/XF/Template/Templater.php(27): XF\Template\Templater->renderTemplate('dbtech_credits_...', Array, true)
#3 src/XF/Template/Template.php(24): BR\ModernStatistic\XF\Template\Templater->renderTemplate('public:dbtech_c...', Array)
#4 src/XF/Mvc/Renderer/Json.php(84): XF\Template\Template->render()
#5 src/XF/Mvc/Renderer/Json.php(68): XF\Mvc\Renderer\Json->renderHtmlFallback('DBTech\\Credits:...', 'public:dbtech_c...', Array)
#6 src/XF/Mvc/Dispatcher.php(418): XF\Mvc\Renderer\Json->renderView('DBTech\\Credits:...', 'public:dbtech_c...', Array)
#7 src/XF/Mvc/Dispatcher.php(400): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(360): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Json), Object(XF\Mvc\Reply\View))
#9 src/XF/Mvc/Dispatcher.php(53): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'json')
#10 src/XF/App.php(2178): XF\Mvc\Dispatcher->run()
#11 src/XF.php(390): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
Request State
array(4) {
["url"] => string(150) "/currency/currency/coin.3/?user_id=19881&_xfRequestUri=%2F&_xfWithData=1&_xfToken=1572830125%2Cb316953a015f3b1a7bb50e92e55cf&_xfResponseType=json"
["referrer"] => string(19) "https://xxx.com/"
["_GET"] => array(5) {
["user_id"] => string(5) "19881"
["_xfRequestUri"] => string(1) "/"
["_xfWithData"] => string(1) "1"
["_xfToken"] => string(43) "1572830125,2Cb316953a015f3b1a7bb50e92e55cf"
["_xfResponseType"] => string(4) "json"
}
["_POST"] => array(0) {
}
}


I also got
  • ErrorException: Template error: Illegal string offset 'adjust'
  • internal_data/code_cache/templates/l2/s4/public/dbtech_credits_currency.php:109

and

  • ErrorException: Template error: Illegal string offset 'purchase'
  • internal_data/code_cache/templates/l2/s4/public/dbtech_credits_currency.php:180
 
Revert your dbtech_credits_currency template.
Thank you

I'm now using mariadb 10.4 (which I told you before in #750)
Could you help me a little bit, about what "join-cache-level = 0" would affect to? My website always get lag after I save template or edit some phrases, it's very annoying
 
Thank you

I'm now using mariadb 10.4 (which I told you before in #750)
Could you help me a little bit, about what "join-cache-level = 0" would affect to? My website always get lag after I save template or edit some phrases, it's very annoying
Sorry, no I can't. All I know is, I've heard multiple people come forward about this bug in MariaDB 10.4 causing performance issues on their forums, and setting that flag fixed it.
 
Sorry, no I can't. All I know is, I've heard multiple people come forward about this bug in MariaDB 10.4 causing performance issues on their forums, and setting that flag fixed it.
I tried to create a clone server with same website (which is running) for test
Test server accessing with ip domain, like 123.456.78. No https, and it goes smoothly, I see no issue, meanwhile my main website is running https, sometimes it takes me more than 20 secs to load a page after I save a template or a phrase
A little bit information for you in this issue
 
Top Bottom