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

XenForo/WordPress Promote Bridge

Discussion in 'XenForo Development Discussions' started by Mythotical, Sep 28, 2011.

  1. Mythotical

    Mythotical Well-Known Member

    I'm developing a XenForo/WordPress bridge that will allow the promotion of threads only. It will require a WordPress to XenForo bridge for other uses. Right now I have it set when an admin or mod clicks Promote to Article, it loads a new page, currently it just the editor and a submit button. What I need to do is pass all the post info for that thread to the promote page so all fields can be filled in and ready for editing if necessary.

    How will I accomplish what I want?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    If it was me I would include the threadid in the "Promote to Article" link. Then use that id in your controller to fetch the thread using the thread model. So you fetch the information rather than submit it as part of the request.
     
  3. yavuz

    yavuz Well-Known Member

    I don't mean to discourage but there is a new bridge that does that. I don't know if you aware of it Steve. Jaxel's portal has a promotion function, you may look how it works or ask him. Please ignore if you knew :)
     
  4. bambua

    bambua Well-Known Member

    ACtually I think the Xenscripts bridge only does it in the WP->XF direction not the other way around unless I missed a feature.
     
  5. yavuz

    yavuz Well-Known Member

    Ok, I did not read it right. Steve was mentioning XF ->WP.

    Sorry, It's late and I'm tired :D
     
  6. Mythotical

    Mythotical Well-Known Member

    No problem, this is just a promote link only to WP. I didn't want to reinvent the wheel by building a whole bridge so I just decided to go reverse.

    Thanks for pointing those out, I did not know anything was able to promote that was available.

    Thats what I thought too, but I'm having trouble getting it to even pull that information let alone get the threadid to include in the link. My link is set up below:
    HTML:
    <xen:if is="{$canPromote}"><a href="{xen:link 'wp/promote', $post}" class="item control report" data-cacheOverlay="false"><span></span>{xen:phrase xfwp_promote}</a></xen:if>[/hmtl]
    
    I even tried just {xen:link wp/promote, $post} so maybe I'm missing something there.
     
  7. Mythotical

    Mythotical Well-Known Member

    Oh yeah one more thing, using {xen:raw $editorTemplate} will that automatically grab the message data being passed or do I need to somehow tell it to use it as a value for the editor?
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    If you are passing in the post array then you need an appropriate link handler. Or you can manually specify the parameters. Something like this:

    Code:
    {xen:link 'wp/promote', '', 'thread_id={$post.thread_id}'}
    
     
  9. Mythotical

    Mythotical Well-Known Member

    Ok explain this link handler to me. Is there an example somewhere to give me an idea?
     
  10. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You need to build it. See this controller as an example (for editing a post):

    XenForo_ControllerPublic_Post::actionEdit

    This controller then calls on this view:

    XenForo_ViewPublic_Post_Edit::renderHtml

    You can see it builds the editorTemplate using the content of the post:

    PHP:
    <?php

    class XenForo_ViewPublic_Post_Edit extends XenForo_ViewPublic_Base
    {
        public function 
    renderHtml()
        {
            
    $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate(
                
    $this'message'$this->_params['post']['message']
            );
        }
    }
     
  11. Mythotical

    Mythotical Well-Known Member

    Yep I have that built, so I see where my mistake was with that. I will edit it and reupload. Thanks for pointing that out to me.
     
  12. Mythotical

    Mythotical Well-Known Member

    Guess I should repeat this as Jake posted right after me which kinda buries it. ;)
     
  13. DRE

    DRE Well-Known Member

    Is there a wordpress/xenforo login widget somewhere?
     
  14. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I haven't written a link builder yet. I want to try my hand at the code first before I tell you how to do it. :p
     
  15. Digital Doctor

    Digital Doctor Well-Known Member

    Really ?
    Steve: I think you have too many projects on the go already.
    Now Xenforo / Wordpress ?
    If you get 8 things done with 85% end user satisfaction and 90% completion ...you won't sell anything and you'll scare people off.
    You need to buckle down and make a killer XFArcade.
    Try to get XFArcade released with very few glitches.
    No loose ends.

    A few months back I gave you your list of "Things you are working on".
    It was too long then.
    Since then you've added alot.
    Unless I am missing something .... I don't see any of your projects complete enough such that you are getting alot of paying customers.

    Focus !!!! make a killer XFArcade. Don't do anything until that is complete.

    Don't shoot the Messenger ! :) Just trying to help.
     
  16. Mythotical

    Mythotical Well-Known Member

    Unfortunately I get paid to do this type of work so I have to concentrate on my clients before free projects. Please don't pop into my threads like that with comments like that, I really don't appreciate them as when I get them the person making them does not know I run a web design business as well: http://codiums.com so I have to do client work first and foremost as they have an expected delivery date.
     
  17. Mythotical

    Mythotical Well-Known Member

    LOL no problem, I will play around and see if I can come up with something and I'll PC you what I find out.
     
  18. Mythotical

    Mythotical Well-Known Member

    Ok found my problem, I was passing the wrong data, I used $post.thread_id and was trying to get it by post_id which was wrong. Oops. Now to only make the link show in the thread's first post.

    Any ideas about that Jake?
     
  19. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That would be done in the templates:

    Admin CP -> Appearance -> Templates -> message

    Use this condition:

    Code:
    <xen:if is="{$message.position} == 0">
    	HTML FOR FIRST POST
    </xen:if>
    
     
  20. Mythotical

    Mythotical Well-Known Member

    Perfect thanks Jake, you've been a big help. Maybe I can get this finished tonight and rolled out to my customer.
     

Share This Page