Idhae
Active member
hello,
i hope someone could help.
I have an option field where i could set a number of min. posts per user to allow him posting external links. For example if he or she has 10 posts made, external link posting allowed.
What i've done so far:
i have extend the checkValidity function in XF\Service\Message\Preparer:
Also extend XF\BbCode\Renderer\Html ->renderTagUrl:
ERROR:
MyAddon\Dir\XF\BbCode\Renderer\XFCP_Html' not found
i hope someone could help.
I have an option field where i could set a number of min. posts per user to allow him posting external links. For example if he or she has 10 posts made, external link posting allowed.
What i've done so far:
i have extend the checkValidity function in XF\Service\Message\Preparer:
PHP:
//check for externalLink settings
$visitor = \XF::visitor();
$postCountSetting = \XF::options()->external_link_forbidden;
if($postCountSetting > 0 && !($visitor['is_admin'] || $visitor['is_moderator']))
{
if($visitor['message_count'] < $postCountSetting)
{
/* error !!! */
$externalLink = new \MyAddon\Dir\XF\BbCode\Renderer\Html;
$externalLink = $externalLink->getExternalUrlCount();
/* error !!! */
if($externalLink > 0)
{
$this->errors[] = 'Posting not allowed with less then ' . $postCountSetting . ' posts';
}
}
}
Also extend XF\BbCode\Renderer\Html ->renderTagUrl:
PHP:
//check externalLink
if ($url)
{
$link = $this->formatter->getLinkClassTarget($url);
if ($link['type'] != 'internal')
{
$this->_externalUrlCount ++;
}
}
// and add a new public function
public function getExternalUrlCount()
{
return $this->_externalUrlCount;
}
ERROR:
MyAddon\Dir\XF\BbCode\Renderer\XFCP_Html' not found