Recent content by grantus

  1. grantus

    XF 2.2 Using the editor in my own template

    I completely forgot about quick-reply! I've never seen _xfWithData before. I just looked it up and for example in Post.php there's if ($this->filter('_xfWithData', 'bool')
  2. grantus

    XF 2.2 Using the editor in my own template

    Ok, thanks. So far I'm on track, I'm able to insert no problem, but in the editor when I post, the message stays in the editor (I eventually want the same functionality as here in the thread view). Is there something in the editor template syntax that should be added, or is it just a matter of...
  3. grantus

    XF 2.2 Using the editor in my own template

    I put $battle->save(); in the actionBattleComment function and so far my post is saving.
  4. grantus

    XF 2.2 Using the editor in my own template

    I tried that but I don't see an EditorPlugin, but there's an Editor file so I did this: $editorPlugin = $this->plugin(\XF\ControllerPlugin\Editor::class); $message = $editorPlugin->fromInput('message'); $form = $this->formAction(); $form->setup(function () use ($battle...
  5. grantus

    XF 2.2 Using the editor in my own template

    I'm wondering what is the correct way to use Xenforo's editor in my own template. I have this so far in my template: <xf:form action="{{ link('battle/comment', $battle) }}" class="block" ajax="1"> <div class="block-container"> <div...
  6. grantus

    XF 2.2 Custom widget help

    Ah, ok I get it. I just added it as a widget definition instead and it works fine. There was an error about and admin template so I created that and the error went away. Thanks for the tip!
  7. grantus

    XF 2.2 Custom widget help

    Yes, I'm doing a php callback. What would be the difference?
  8. grantus

    XF 2.2 Custom widget help

    I created my widget definition called "test_widget". I created a template called "test_widget_tpl". Here's my code: namespace Test\ILL\Widgets; use XF\Widget\AbstractWidget; class TestWidget extends AbstractWidget { protected $defaultOptions = []; public function render() {...
  9. grantus

    XF 2.2 Issue with deleting a row

    D'oh! Don't know why I did that lol. So obvious. Thanks, it works.
  10. grantus

    XF 2.2 Issue with deleting a row

    I'm trying to delete a row: private static function deletePending($table, $upload_id) { $db = \XF::db(); $rowsDeleted = $db->delete($table, [ 'upload_id' => $upload_id ]); } And I'm calling it in another method like this...
  11. grantus

    XF 2.2 How can I calculate this inside a template?

    Inside my template I need to calculate a time from my db table (in UNIX format) then divide a value, minus the current time, and then format it. For example: ({$item.end_date} / 60) - {$xf.time} Is $xf.time already in UNIX format?
  12. grantus

    XF 2.1 Cron entry title

    The more I look at it, I think processing the finished battles all at once is the best approach since it's less strain on the server. This way there's only one cron job.
  13. grantus

    XF 2.1 Cron entry title

    It's a battle system I have set up, so right now it's basically User1 challenges User2. If User2 accepts, a cron job is created with a battle start and end time. At the end time the cron job will trigger the code that calculates the results. So I have everything in a separate table, it's just...
  14. grantus

    XF 2.1 Cron entry title

    I'm inserting a cron job like this: $updateFight = $db->insert('xf_cron_entry', [ 'entry_id' => 'fight' . $newBattleId, 'cron_class' => 'Battles\ILL\Cron\Fights', 'cron_method' => 'fightInsert', 'run_rules' => '{"day_type":"dom","dom":[22],"hours":[15],"minutes":[17],"battle":['...
  15. grantus

    XF 2.1 Retrieve a value from the url with filterUrl

    I'm building a page where I'm checking the params to see who is on the page, either a sender or receiver. In my URL it would be like this: sender: cpanel/challenge/{id here}/ receiver: cpanel/challenge/view/{alert id here}/ The issue is that since 'challenge' is in the URL for both, it's...
Back
Top Bottom