The Arcive of vBulletin Modifications Site. |
|
|
#1
|
||||
|
||||
|
This is a first time my doing this with vb4 and I need some help. This seems easy but I'm struggling with it bad.
I have added a sample product showing the 2 ways I am trying to add buttons within a post. thanks to shka I have the custom template one working, the parse_template one is not fetching the threadid though. I have tried pulling the threadid from postbit, and showthread within plugins. example arse templat (in a showthread condition) i am just using new thread button in posts as a base, I want to add a button that will be grabbing the threadid not the forum id.Code:
$sessionurl = $session['sessionurl'];
$threadidid = '{vb:raw threadid}';
$post_phrase = 'Refresh this Listing';
$new_thread_link = '<div><a href="refresh.php?'.$sessionurl.'do=newthread&f='.$threadid.'" rel="nofollow" class="newcontent_textcontrol" id="newthreadlink_top" style="margin-left:10px;"><span>+</span> '.$post_phrase.'</a></div>';
$find = '<div id="pagination_top"';
$replace = $new_thread_link.$find;
$vbulletin->templatecache['SHOWTHREAD'] = str_replace($find, $replace, $vbulletin->templatecache['SHOWTHREAD']);
but I am not having any luck. I first wanted to do this in postbit, but was having the same issue. Using post thanks button placement as my base, I could not get the threadid to input: Code:
<template name="post_thanks_button" templatetype="template" date="1477136504" username="Abe1" version="7.88"><![CDATA[
<vb:if condition="$post['userid'] != 0">
<a href="postings.php?t={vb:raw threadid}" class="post_thanks_button">Refresh</a>
</vb:if>]]></template>
Code:
<plugin active="1" executionorder="5">
<title>Post Thank You Hack</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[if ($this->post[postid] == $this->thread[firstpostid]){
$display_thanks_image = '';
$templater = vB_Template::create('post_thanks_button');
$templater->register('post', $post);
$templater->register('display_thanks_image', $display_thanks_image);
$template_hook['postbit_controls'] .= $templater->render();
}
]]></phpcode>
</plugin>
|
|
#2
|
||||
|
||||
|
Forum ID seems to be missing
$threadidid = '{vb:raw threadid}'; PHP Code:
|
| Благодарность от: | ||
| Dr.CustUmz | ||
|
#3
|
||||
|
||||
|
Quote:
this is what I have, no other plugin: (parse templates) PHP Code:
I have also tried: Code:
<plugin active="1" executionorder="5">
<title>new postbit button</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[if (THIS_SCRIPT === showthread)
{
$cache[] = 'my_template';
}]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>new postbit button</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[if ($this->post[postid] == $this->thread[firstpostid]){
$display_refresh_image = '';
$templater = vB_Template::create('my_template');
$templater->register('post', $post);
$templater->register('display_refresh_image', $display_refresh_image);
$template_hook['postbit_controls'] .= $templater->render();
}
]]></phpcode>
</plugin>
|
|
#4
|
|||
|
|||
|
Which template?
In postbit_legacy or post_thanks_button Code:
{vb:raw post.threadid}
|
| Благодарность от: | ||
| Dr.CustUmz | ||
|
#5
|
||||
|
||||
|
Quote:
I have updated my code above your post to show ways I have tried. I thought the post thanks hack would be a good reference point because it had the button where i wanted but I cant seem to get threadid within the template. I read this post from kh99: Quote:
lol
|
|
#6
|
|||
|
|||
|
Either my English is too bad and I don't understand you.
Or you didn't read my post / code. |
|
#7
|
||||
|
||||
|
I am providing my button test, this plugin simply adds a button to the postbit, and to the showthread.
both added buttons I can not get the threadid. see code. |
|
#8
|
||||
|
||||
|
{vb:raw post.threadid} WORKED FOR THE POSTBIT ONE! THANK YOU! but how can I get the showthread one to show threadid?
|
|
#9
|
|||
|
|||
|
Code:
{vb:raw threadinfo.threadid}
Code:
In your plugin code you can use $threadinfo['threadid']. ... https://www.vbulletin.com/docs/html?...rsion=40205500 Styles & Templates / vBulletin Style Reference / Templates / Template Syntax Read Variable Access (and the other stuff)
|
|
#10
|
||||
|
||||
|
using parse_templates on the showthread template
using $threadinfo[threadid] my link spits out refresh.php?do=newthread&t=$threadinfo[threadid] using '.$threadinfo['threadid'].' my link spits out: rrefresh.php?do=newthread&t= |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|