vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   hook $template_hook[postbit_user_popup] - problems (https://vborg.vbsupport.ru/showthread.php?t=150769)

Makc666 06-27-2007 09:16 AM

hook $template_hook[postbit_user_popup] - problems
 
1 Attachment(s)
There is hook:
$template_hook[postbit_user_popup]

Example 1:
HTML Code:

<template name="test" templatetype="template" date="1182869201" username="Makc666" version="1.0.0">
<![CDATA[
<if condition="$show['pmlink']">

<tr><td class="vbmenu_option">Test Phrase - PostID $post[postid] - Postcount $post[postcount]</td></tr>
</if>
]]>
</template>

<plugin active="1" executionorder="5">
<title>Test (1)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
eval('$template_hook[postbit_user_popup] = "' . fetch_template('test') . '";');
]]>

</phpcode>
</plugin>

Example 2:
HTML Code:

<template name="test" templatetype="template" date="1182869201" username="Makc666" version="1.0.0">
<![CDATA[
<if condition="$show['pmlink']">

<tr><td class="vbmenu_option">Test Phrase - PostID $post[postid] - Postcount $post[postcount]</td></tr>
</if>
]]>
</template>

<plugin active="1" executionorder="5">
<title>Test (1)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test') . '";');
]]>

</phpcode>
</plugin>


The difference between Example 1 and Example 2 is on line:
eval('$template_hook[postbit_user_popup] = "' . fetch_template('test') . '";');

In Example 1 there is NO . (dot) near =
In Example 2 there is . (dot) near .=

If I use Example 1 then I replace
$template_hook[postbit_user_popup]
with my template
and no one will not be able to use
$template_hook[postbit_user_popup]
once again in another product.

You will say, use Example 2 with . (dot) near .=
as for example in this article is advised:
https://vborg.vbsupport.ru/showthread.php?t=147447

But if I use Example 2 I have some problem...

Look on screenshot.

I don't know what to do...
P.S. I don't want manual template changes.

Dismounted 06-27-2007 09:27 AM

What other modifications do you have that uses this template hook?

Makc666 06-27-2007 09:38 AM

Quote:

Originally Posted by Dismounted (Post 1277558)
What other modifications do you have that uses this template hook?

There is any other modifications there... It is a clean board.

Do you understand what is the nature of that problem?
I understand, but I can't find a sollution fot it.

May be I am using wrong hookname...
<hookname>postbit_display_complete</hookname

Dismounted 06-27-2007 09:54 AM

I know what you mean, but since you have no mods, what's the problem with just assigning it? Anyway, try this:
HTML Code:

<template name="test" templatetype="template" date="1182869201" username="Makc666" version="1.0.0">
<![CDATA[
<if condition="$show['pmlink']">

<tr><td class="vbmenu_option">Test Pharase</td></tr>
</if>
]]>
</template>

<plugin active="1" executionorder="5">
<title>Test (1)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[if ($post['postcount'] == 1)
{
  eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test') . '";');
}]]>

</phpcode>
</plugin>


Makc666 06-27-2007 10:19 AM

Quote:

Originally Posted by Dismounted (Post 1277578)
I know what you mean, but since you have no mods, what's the problem with just assigning it?

I have no mods because this is a test forum :) Just for test.
I am making a product and don't want to assign it.

I am realy wondering it that hook will real work there?

Quote:

Originally Posted by Dismounted (Post 1277578)
Anyway, try this:
HTML Code:

<template name="test" templatetype="template" date="1182869201" username="Makc666" version="1.0.0">
<![CDATA[
<if condition="$show['pmlink']">

<tr><td class="vbmenu_option">Test Pharase</td></tr>
</if>
]]>
</template>

<plugin active="1" executionorder="5">
<title>Test (1)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[if ($post['postcount'] == 1)
{
  eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test') . '";');
}]]>

</phpcode>
</plugin>


No, this one didn't help.
Yes it will display only one line of mine.
But it will display in every post the line which belongs to the first post.

Also it will not work on pages like this one:
https://vborg.vbsupport.ru/showpost....78&postcount=4

I understand that I have to make some checkup but I can't "cook up" one and also I don't want to right a SQL query for that think up.

Dismounted 06-27-2007 12:01 PM

Quote:

Originally Posted by Makc666 (Post 1277587)
No, this one didn't help.
Yes it will display only one line of mine.
But it will display in every post the line which belongs to the first post.

Hmm. Use your one, but add a plugin at postbit_display_start with this:
PHP Code:

unset($template_hook['postbit_user_popup']); 

Make sure the execution order is 1.

Makc666 06-27-2007 12:36 PM

1 Attachment(s)
Quote:

Originally Posted by Dismounted (Post 1277635)
Hmm. Use your one, but add a plugin at postbit_display_start with this:
PHP Code:

unset($template_hook['postbit_user_popup']); 

Make sure the execution order is 1.

Dismounted, you edited your post while I was writing an answer for you :)

The answer for "old" post:

I have replaced text:
Test Phrase
with text:
Test Phrase - PostID $post[postid] - Postcount $post[postcount]
in my first post:
https://vborg.vbsupport.ru/showthread.php?t=150769

And I reuploaded the screenshot also.
So you will understand now clearly :D

But!!!

Here is the answer for "new" post:

I added a line you said me to my code and now it looks like:
HTML Code:

<plugin active="1" executionorder="5">
<title>Test (1)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
unset($template_hook['postbit_user_popup']);
eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test') . '";');
]]>

</phpcode>
</plugin>

And it is working now :)

P.S. Realy I had a thought to destroy the specified variable but... :eek:

Thanks, Dismounted!
I am very happy I now know this little tip now! :)

P.S.S.

Oh...

I remade the code 100% the way you said...

HTML Code:

<plugin active="1" executionorder="1">
<title>Test (0)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
unset($template_hook['postbit_user_popup']);
]]>
</phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Test (1)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test') . '";');
]]>

</phpcode>
</plugin>

Am I right to your words?
Because both variants work there :)

Makc666 06-27-2007 01:38 PM

Cool!
Mike Sullivan just answer me on www.vbulletin.com that this one is connected with BUG introduced in 3.6.7:
http://www.vbulletin.com/forum/showt...64#post1379664

Quote:

Originally Posted by Mike Sullivan


Dismounted 06-28-2007 06:56 AM

HTML Code:

<plugin active="1" executionorder="1">
<title>Test (0)</title>
<hookname>postbit_display_start</hookname>
<phpcode><![CDATA[
unset($template_hook['postbit_user_popup']);
]]>
</phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Test (1)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test') . '";');
]]>

</phpcode>
</plugin>

First one should be at postbit_display_start as other mods may assign them at the first hook.

Makc666 06-28-2007 09:45 AM

Once again Thanks, Dismounted.

As I said that problem is connected with BUG:
http://www.vbulletin.com/forum/proje...?issueid=22069

Now I meet with another strange problem.

I added a check in my code:

HTML Code:

<plugin active="1" executionorder="5" product="test">
<title>Test One (2)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[
if ($vbulletin->
options['test_enable_global'])
{
$template_hook[postbit_user_popup] = print "->123<-";
}
else
{
$template_hook[postbit_user_popup] = print "->
456<-";
}
]]>
</phpcode>
</plugin>

But it (check) doesn't want to work!
As I see value
$vbulletin->options['test_enable_global']
is not return to plugin.

I attached test.xml which is a simle test product with that code.
->123<- or ->456<- are printed on forum/showthread.php page on the top.
Moved attachment here:
https://vborg.vbsupport.ru/showpost....4&postcount=14

Maybe you can help me with this one.
As I realy don't understand if this one connected with that BUG: issueid=22069


All times are GMT. The time now is 02:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04275 seconds
  • Memory Usage 1,777KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_html_printable
  • (2)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete