Recent content by grantus

  1. 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!
  2. grantus

    XF 2.2 Custom widget help

    Yes, I'm doing a php callback. What would be the difference?
  3. 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() {...
  4. grantus

    XF 2.2 Issue with deleting a row

    D'oh! Don't know why I did that lol. So obvious. Thanks, it works.
  5. 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...
  6. 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?
  7. 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.
  8. 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...
  9. 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":['...
  10. 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...
  11. grantus

    XF 2.1 How do I format this template link?

    This is what I was trying before: {{ link('newbattle/cpanel/r/save', {'r': $receiver_user_id}, $newbattle)}} but I was getting errors about $newbattle at the end. So now: {{ link('newbattle/cpanel/r/save', {'r': $receiver_user_id})}} works great. Thanks.
  12. grantus

    XF 2.1 How do I format this template link?

    Just standard like this: cpanel/r/:int<r>/ In my controller: public function getParamUserId(ParameterBag $params) { $params_user_id = $params->r; return $params_user_id; } Then I call $this->getParamUserId($params) where needed in my other methods.
  13. grantus

    XF 2.1 How do I format this template link?

    I have my form action: <xf:form action="{{ link('newbattle/cpanel/save', $newbattle) }}" upload="true" ajax="true" class="block"> My url is like this: newbattle/cpanel/r/24496/add. Since the form is linking to newbattle/cpanel/save it's not working. How should the link be formatted since I...
  14. grantus

    XF 2.1 Alert is not showing

    I dumped the alert page but it wasn't even showing the content_type, so it's confusing. I'm going to work with the user content_type since it seems to work no problem.
  15. grantus

    XF 2.1 Alert is not showing

    I just tested it again by changing the content_type to 'user' and the action to 'newbattle', then named my template alert_user_newbattle and now I see the alert. Why is that? Why would my content_type not work? I even copied the exact code from XF\Alert\User and changed the class to NewBattle...
Back
Top Bottom