Show "Identity Services" content on new page

PoLiZe

Well-known member
Hi people, i'm making a new page on my XenForo.

And the page was i'm making is for update the content for the Identity Services..

I can save the content of the field (i put a form on the page, and work fine)

But the problem is that.. i need put the "Identity Services Content" on the "value" parameter on the Fields..

delta.webp
¿How i can make it?
 
PHP:
$userModel = $this->getModelFromCache('XenForo_Model_User');
$identities = $userModel->getIdentities(XenForo_Visitor::getUserId());

and then you can access it via $identities['..']
 
I now make my add-on, i create the route ( http://www.deltaforos.com/Socials/ )
And have this listeener
PHP:
<?php

class Socials_Listener_Template
{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        switch ($hookName)
        {
            case 'Socials':
            {

                $userModel = $this->getModelFromCache('XenForo_Model_User');
                $identities = $userModel->getIdentities(XenForo_Visitor::getUserId());

                if (!empty($identities['Samp'])) {
                    $SampId = $identities['Samp'];
                    $ourTemplate = $template->create('Socials_index');
                    $ourTemplate->setParam('Samp', $SampId);
                    $contents .= $ourTemplate->render();
                }

                break;
            }
        }
    }
}

But don't work

And on the template i have:

HTML:
<input type="text" name="identity[Samp]" value="{$Samp}" class="textCtrl" id="ctrl_Samp dir="ltr" maxlength="100" data-fieldName="samp" />
 
Try this:
PHP:
<?php

class Socials_Listener_Template
{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        switch ($hookName)
        {
            case 'Socials':
            {

                $userModel = $this->getModelFromCache('XenForo_Model_User');
                $identities = $userModel->getIdentities(XenForo_Visitor::getUserId());
                if (!empty($identities['Samp'])) {
                    $SampId = $identities['Samp'];
                    $viewParams = array(
                        'SampId'    =>    $SampId);
                    $contents .= $template->create('Socials_index', $viewParams);
                }

                break;
            }
        }
    }
}

Salud2
 
This is my controller:

PHP:
<?php

class Socials_ControllerPublic_Index extends XenForo_ControllerPublic_Abstract
{

public function actionIndex()
{

$userModel = $this->getModelFromCache('XenForo_Model_User');
                $identities = $userModel->getIdentities(XenForo_Visitor::getUserId());
  
return $this->responseView('Socials_ViewPublic_Index', 'Socials_index', $identities);
}

}
and my listener
PHP:
<?php
class Socials_Listener_Template
{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        switch ($hookName)
        {
            case 'Socials':
            {
                $userModel = $this->getModelFromCache('XenForo_Model_User');
                $identities = $userModel->getIdentities(XenForo_Visitor::getUserId());
                if (!empty($identities['Samp'])) {
                    $SampId = $identities['Samp'];
                    $viewParams = array(
                        'SampId'    =>    $SampId);
                    $contents .= $template->create('Socials_index', $viewParams);
                }
                break;
            }
        }
    }
}
 
In the listener, only create the templete
PHP:
<?php
class Socials_Listener_Template
{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        switch ($hookName)
        {
            case 'Socials':
            {
                $contents .= $template->create('Socials_index');
                break;
            }
        }
    }
}
Refer $identities as your template variable.

Salud2

 
Try with
PHP:
<?php
class Socials_Listener_Template
{
    public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    {
        switch ($hookName)
        {
            case 'Socials':
            {
                $userModel = $this->getModelFromCache('XenForo_Model_User');
                $identities = $userModel->getIdentities(XenForo_Visitor::getUserId());
                if (!empty($identities['Samp'])) {
                    $SampId = $identities['Samp'];
                    $viewParams = array(
                        'SampId'    =>    $SampId);
                    $hookParams = array_merge($hookParams, $viewParams);
                    $contents .= $template->create('Socials_index', $hookParams);
                }
                break;
            }
        }
    }
}

Salud2
 
Top Bottom