I've followed the dev guide to create an addon that creates a new table with some columns for data.
I'd like for users to be able to write data to these columns via bbcode in posts - is this possible? Ideally I'd like to pass some other information from the post as well like user_id, post_id, thread_id to store in my new table.
So if I use the example below of a basic bbcode callback which takes a couple of options and prints them to the screen. Can I store the data from those options in my new table and grab some post data to store in the table as well?
Thanks in advance for any help.
I'd like for users to be able to write data to these columns via bbcode in posts - is this possible? Ideally I'd like to pass some other information from the post as well like user_id, post_id, thread_id to store in my new table.
So if I use the example below of a basic bbcode callback which takes a couple of options and prints them to the screen. Can I store the data from those options in my new table and grab some post data to store in the table as well?
Thanks in advance for any help.
PHP:
<?php
namespace TFC\BBCode\Test;
class BbcodeParser {
public static function test($tagChildren, $tagOption, $tag, array $options, \XF\BbCode\Renderer\AbstractRenderer $renderer)
{
$res = $renderer->renderSubTree($tagChildren, $options);
$toptions = trim(strip_tags($tag['option']));
$toptions = array_values(array_filter(explode(',', $toptions)));
@list($data1, $data2) = $toptions;
if ($tmp = trim($data1)) {
$data1 = "$tmp";
}
if ($tmp = trim($data2)) {
$data2 = "$tmp";
}
return "{$data1} {$data2}";
}
}