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

XenForo/WordPress Promote Bridge

Mythotical

Well-known member
#1
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?
 

Jake Bunce

XenForo moderator
Staff member
#2
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.
 

yavuz

Well-known member
#3
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 :)
 

bambua

Well-known member
#4
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 :)
ACtually I think the Xenscripts bridge only does it in the WP->XF direction not the other way around unless I missed a feature.
 

Mythotical

Well-known member
#6
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.

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.
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.
 

Mythotical

Well-known member
#7
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?
 

Jake Bunce

XenForo moderator
Staff member
#8
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.
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}'}
 

Mythotical

Well-known member
#9
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}'}
Ok explain this link handler to me. Is there an example somewhere to give me an idea?
 

Jake Bunce

XenForo moderator
Staff member
#10
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?
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']
		);
	}
}
 

Digital Doctor

Well-known member
#15
I'm developing a XenForo/WordPress bridge
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.
 

Mythotical

Well-known member
#16
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.
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.
 

Mythotical

Well-known member
#18
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']
);
}
}
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?
 

Mythotical

Well-known member
#20
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>
Perfect thanks Jake, you've been a big help. Maybe I can get this finished tonight and rolled out to my customer.