Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 06-27-2007, 09:16 AM
Makc666's Avatar
Makc666 Makc666 is offline
 
Join Date: Dec 2002
Location: MSK-RU
Posts: 392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default hook $template_hook[postbit_user_popup] - problems

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.
Attached Images
File Type: png postbit_user_popup_new.png (41.2 KB, 0 views)
Reply With Quote
  #2  
Old 06-27-2007, 09:27 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What other modifications do you have that uses this template hook?
Reply With Quote
  #3  
Old 06-27-2007, 09:38 AM
Makc666's Avatar
Makc666 Makc666 is offline
 
Join Date: Dec 2002
Location: MSK-RU
Posts: 392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
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
Reply With Quote
  #4  
Old 06-27-2007, 09:54 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #5  
Old 06-27-2007, 10:19 AM
Makc666's Avatar
Makc666 Makc666 is offline
 
Join Date: Dec 2002
Location: MSK-RU
Posts: 392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View Post
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 View Post
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.
Reply With Quote
  #6  
Old 06-27-2007, 12:01 PM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Makc666 View Post
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.
Reply With Quote
  #7  
Old 06-27-2007, 12:36 PM
Makc666's Avatar
Makc666 Makc666 is offline
 
Join Date: Dec 2002
Location: MSK-RU
Posts: 392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dismounted View 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.
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

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

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
Attached Images
File Type: png postbit_user_popup_02_fixed_w.png (45.1 KB, 0 views)
Reply With Quote
  #8  
Old 06-27-2007, 01:38 PM
Makc666's Avatar
Makc666 Makc666 is offline
 
Join Date: Dec 2002
Location: MSK-RU
Posts: 392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #9  
Old 06-28-2007, 06:56 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 06-28-2007, 09:45 AM
Makc666's Avatar
Makc666 Makc666 is offline
 
Join Date: Dec 2002
Location: MSK-RU
Posts: 392
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:06 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.11902 seconds
  • Memory Usage 2,318KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (8)bbcode_html
  • (2)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete