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

I'm confused with the way that xenforo work! totally different from VB

Discussion in 'XenForo Pre-Sales Questions' started by EgyKit, Apr 17, 2012.

Thread Status:
Not open for further replies.
  1. EgyKit

    EgyKit Member

    Hello,

    I'm a new member here and I'm interested in moving to xenforo software but I'm confused because I don't understand how to modify default xenforo codes by hook system like I used to do in vbulletin :(

    How to add code to modify xenforo code without changing the default code by using add-on, I need some detailed tutorials for that.

    This is my forum and I have many custom plugins which I've created using the hook system, I tried to look into xenforo add-on but it was very hard to me to understand, I learned php mainly from vBulletin.

    http://www.egykit.com

    Thanks.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Sadik B

    Sadik B Well-Known Member

  4. EgyKit

    EgyKit Member

    Thank you, this was helpful, but with vbulletin it was easy think and expect where to edit code by using the hook system even template changes I made via hook system with vbulletin.

    I watched the above video that explain the xen hook system in templates, but if I wanted to edit some template content that is not included in <xen:hook> how to do that?

    Also, if I want to edit registration process how to expect the code event listener I should use :( and I'm thinking that I could use the add-on system in xenforo to change any default code by using the add-on system unlike vbulletin where I must change the default code in the php files if I can't find the default hook for that? or xenforo have some limits too that will force me to change the default code like I do with vB?

    Thanks.
     
  5. EgyKit

    EgyKit Member

    Thank you, what I understood from this video it's limited to template content included within <xen:hook> tag. how to edit other template content! I used to do that with vbulletin using the templatecache, is there any similar way in xenforo that allow me to do that?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no good way to do that. You can use template_post_render to operate on the rendered HTML. Or you can use template_create to replace the entire templates. Those are both covered in the examples I posted:

    http://xenforo.com/community/threads/adding-own-thread-search-criteria.20193/#post-261191

    You can extend XenForo_ControllerPublic_Register using the load_class_controller event. Extending the existing controller allows you to override any function in that class. The actionRegister() function is what registers a user.
     
  7. EgyKit

    EgyKit Member

    So you mean template_post_render is a global code event listener for all templates to handle template contents that not located within the <xen:hook> tag?

    Also how to register custom variables to the templates? is there a global code event listener for that? I must fully understand before I move to xenforo because I prefer to do all my custom changes with add-ons to make upgrade easy and fast without manually editing templates, code etc. :)

    Is there any example that override function before it save data to the database? I want to add custom add-on to verify email before registration like I use in vBulletin.

    Thanks, I appreciate your patience.
     
  8. Sadik B

    Sadik B Well-Known Member

    While you can learn your way to code in Xenforo to make template changes on the fly, however there is this excellent addon: Template Modification System through which you can modify rendered templates and not worry at all for upgrades.
     
  9. EgyKit

    EgyKit Member

    I have a question about Arabic characters in xenforo in forums, threads titles, they appear as rawurlencoded and not like valid Arabic characters as in vBulletin in IE! is there any add-on that would fix that?

    This is my demo board;

    http://demo.xenforo.com/?d=3744f7449e480fb5

    Go to main forum them hold your mouse on the thread title to see what I mean

    http://demo.xenforo.com/112/index.php?forums/main-forum.2/

    Also, I've searched for xml sitemap for xenforo and found an add-on for that and I want to know if this option will be supported within xenforo itself in the upcoming versions or not?

    And what about thread list sort order options in forum sections? it seems that this is not supported yet by xenforo?

    Thanks.
     
  10. Andrej

    Andrej Well-Known Member

    19-04-2012 17-00-36.png

    19-04-2012 17-01-52.png
     
    EgyKit likes this.
  11. Andrej

    Andrej Well-Known Member

    It looks weird in the English language, but if you use the Arabic language it should look better. :p
    19-04-2012 17-11-47.png
     
    EgyKit likes this.
  12. EgyKit

    EgyKit Member

  13. EgyKit

    EgyKit Member

    I changed the language direction as per your reply and still can't see valid Arabic characters when move mouse on thread,forum title and I mean the title portion of the landing url and when I click the link the url will contain the title as rawurlencoded in the browser address bar, I hope you get what I mean :)
     
  14. EgyKit

    EgyKit Member

    I'm trying to create an addon to verify email addresses before registration and I have problem choosing appropriate code event listener,so please help me in this as this maybe the key that help me create all my custom plugins I use with vbulletin :(

    I've extended the XenForo_DataWriter_User class to extend this public function _verifyEmail

    These are the steps I have made,

    from admin cp I created a new event listener
    Listen to Event: load_class_datawriter
    Execute Callback: VerifyEmail_Listener_DataWriter
    Method: listendatawriter
    And this is the content of DataWriter file under VerifyEmail/Listener folders
    PHP:
    class VerifyEmail_Listener_DataWriter
    {
        public static function 
    user($class, array &$extend)
        {
            if (
    $class == 'XenForo_DataWriter_User')
            {
                
    $extend[] = 'VerifyEmail_DataWriter_User';
            }
        }
    }
    And this is the content of the class VerifyEmail_DataWriter_User in User.php file under VerifyEmail/DataWriter folders, this expected to return ajax error beside email address bar, but not working


    PHP:
    class VerifyEmail_DataWriter_User extends XFCP_VerifyEmail_DataWriter_User
    {
        
    /**
        * Verification callback to check the email address is in a valid form
        *
        * @param string Email Address
        *
        * @return bool
        */
        
    protected function _verifyEmail(&$email)
        {
     
            
    //Just for test to return ajax error message that appear beside email bar during registration
            
    $this->error(new XenForo_Phrase('email_addresses_must_be_unique'), 'email');
        }
    }
    Does error() by default return ajax error in xenforo?

    I don't know where is the error in my code, and please be patient as this is my first addon I try to create in xenforo :(
     
  15. Brogan

    Brogan XenForo Moderator Staff Member

    How do you have access to the code without a licence?

    It would appear at this point that you are using a nulled version and trying to get support in the pre-sales forum.

    Closed.
     
Thread Status:
Not open for further replies.

Share This Page