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

Dismounted 06-29-2007 06:16 AM

HTML Code:

<plugin active="1" executionorder="5" product="test">
<title>Test One (2)</title>
<hookname>postbit_display_complete</hookname>
<phpcode><![CDATA[global $vbulletin;

if ($vbulletin->
options['test_enable_global'])
{
$template_hook[postbit_user_popup] = print "->123<-";
}
else
{
$template_hook[postbit_user_popup] = print "->
456<-";
}
]]>
</phpcode>
</plugin>


Makc666 06-29-2007 01:32 PM

Thanks, Dismounted!
This one helped.

P.S. Saying the truth I was trying to do the same way, but it didn't help :) I think I have to get some rest.

Abe1 07-01-2007 02:14 PM

You should have a '.=' not an '='. You are let others use the hook if your hack gets processed after.

Makc666 07-02-2007 07:03 AM

1 Attachment(s)
Quote:

Originally Posted by Abe1 (Post 1280605)
You should have a '.=' not an '='. You are let others use the hook if your hack gets processed after.

Yes. Thanks Abe1 for the note.

Realy, the code must have '.='

I attached a product Test Popup Menu in Postbit (test_postbit.xml) for anyone who want to check this one.

HTML Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="test_postbit" active="1">
<title>Test Popup Menu in Postbit</title>
<description>A simple test product using hook $template_hook[postbit_user_popup] in popup menu of postbit and postbit_legacy template</description>
<version>1.0.0</version>

<templates>
                <template name="test_postbit1" templatetype="template" date="1182869201" username="Makc666" version="1.0.0"><![CDATA[
        <tr>
<td class="vbmenu_option">
        ->123<- | UserName - $post[username] | Post ID - $post[postid]
        </td>
</tr>
        ]]></template>
                <template name="test_postbit2" templatetype="template" date="1182869202" username="Makc666" version="1.0.0"><![CDATA[
        <tr>
<td class="vbmenu_option">
        ->456<- | UserName - $post[username] | Post ID - $post[postid]
        </td>
</tr>
        ]]></template>
</templates>

<plugins>

        <plugin active="1" executionorder="1" product="test_postbit">
                        <title>Test Postbit One (1)</title>
                        <hookname>postbit_display_start</hookname>
                        <phpcode><![CDATA[
                        unset($template_hook['postbit_user_popup']);
]]>
</phpcode>
        </plugin>
       
        <plugin active="1" executionorder="5" product="test_postbit">
                        <title>Test Postbit One (2)</title>
                        <hookname>postbit_display_complete</hookname>
                        <phpcode><![CDATA[
        global $vbulletin;

        if ($vbulletin->
options['test_postbit_enable_global'])
        {
                eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test_postbit1') . '";');
        }
        else
        {
                eval('$template_hook[postbit_user_popup] .= "' . fetch_template('test_postbit2') . '";');
        }
]]></phpcode>
        </plugin>       

</plugins>

<phrases>
        <phrasetype name="vBulletin Settings" fieldname="vbsettings">
                <phrase name="settinggroup_test_postbit"><![CDATA[Test Postbit One]]></phrase>
                <phrase name="setting_test_postbit_enable_global_title"><![CDATA[Enable Whole Hack]]></phrase>
                <phrase name="setting_test_postbit_enable_global_desc"><![CDATA[If you want to disable, just set "No".]]></phrase>
        </phrasetype>
</phrases>

<options>
        <settinggroup name="test_postbit" displayorder="601">
                <setting varname="test_postbit_enable_global" displayorder="5">
                        <datatype>free</datatype>
                        <optioncode>yesno</optioncode>
                        <defaultvalue>1</defaultvalue>
                </setting>
        </settinggroup>
</options>

</product>


Makc666 07-02-2007 11:34 AM

I released a hack based on this code:
Quote Post in PM
https://vborg.vbsupport.ru/showthread.php?t=151163
https://vborg.vbsupport.ru/misc.php?...help&pid=qpipm

Makc666 01-07-2010 10:10 AM

This problem raised again in 4.0.0 PL1 with new hook memberaction_dropdown_items

The bug is here -> http://www.vbulletin.com/forum/proje...?issueid=35014


All times are GMT. The time now is 08:06 PM.

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.01367 seconds
  • Memory Usage 1,830KB
  • 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
  • (10)bbcode_html_printable
  • (2)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete