1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Show "Identity Services" content on new page

Discussion in 'XenForo Development Discussions' started by PoLiZe, Apr 8, 2011.

  1. PoLiZe

    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.JPG
    ┬┐How i can make it?
     
  2. ragtek

    ragtek Guest

    PHP:
    $userModel $this->getModelFromCache('XenForo_Model_User');
    $identities $userModel->getIdentities(XenForo_Visitor::getUserId());
    and then you can access it via $identities['..']
     
    PoLiZe likes this.
  3. PoLiZe

    PoLiZe Well-Known Member

    Where i need put that?
     
  4. Wuebit

    Wuebit Well-Known Member

    In your php file
    See this its pretty much the same question
     
  5. PoLiZe

    PoLiZe Well-Known Member

    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 $hookParamsXenForo_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" />
    
     
  6. XFacil.com

    XFacil.com Active Member

    Try this:
    PHP:
    <?php

    class Socials_Listener_Template
    {
        public static function 
    templateHook($hookName, &$contents, array $hookParamsXenForo_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
     
  7. PoLiZe

    PoLiZe Well-Known Member

    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 $hookParamsXenForo_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;
                }
            }
        }
    }
     
  8. XFacil.com

    XFacil.com Active Member

    In the listener, only create the templete
    PHP:
    <?php
    class Socials_Listener_Template
    {
        public static function 
    templateHook($hookName, &$contents, array $hookParamsXenForo_Template_Abstract $template)
        {
            switch (
    $hookName)
            {
                case 
    'Socials':
                {
                    
    $contents .= $template->create('Socials_index');
                    break;
                }
            }
        }
    }
    Refer $identities as your template variable.

    Salud2

     
  9. PoLiZe

    PoLiZe Well-Known Member

    Not work :'(
     
  10. PoLiZe

    PoLiZe Well-Known Member

    someone can helpme? :'(
     
  11. XFacil.com

    XFacil.com Active Member

    Try with
    PHP:
    <?php
    class Socials_Listener_Template
    {
        public static function 
    templateHook($hookName, &$contents, array $hookParamsXenForo_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
     

Share This Page