Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 12-23-2010, 10:58 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is an example I found from something I did for vb 3 a while back:
Code:
$find_fh = 'accesskey=\"c\" />$vbphrase[remember_me]</label>';
$replace_fh = 'accesskey=\"c\" checked=\"checked\" /> $vbphrase[remember_me]</label>';

$vbulletin->templatecache['navbar'] = str_replace($find_fh, $replace_fh, $vbulletin->templatecache['navbar']);

And another one:
Code:
$find = '<strong>" . construct_phrase("$vbphrase[welcome_x_link_y]", "" . $GLOBALS[\'vbulletin\']->userinfo[\'username\'] . "", "member.php?" . $GLOBALS[\'vbulletin\']->session->vars[\'sessionurl\'] . "u=" . $GLOBALS[\'vbulletin\']->userinfo[\'userid\'] . "") . "</strong><br />';
$replace = '<strong>" . construct_phrase("$vbphrase[ung_greeting]", "$vbphrase[ung_line]", "member.php?" . $GLOBALS[\'vbulletin\']->session->vars[\'sessionurl\'] . "u=" . $GLOBALS[\'vbulletin\']->userinfo[\'userid\'] . "", "$vbphrase[realname]", "$vbphrase[ung_punctuation]") . "</strong><br />';

$vbulletin->templatecache['navbar'] = str_replace($find, $replace, $vbulletin->templatecache['navbar']);

Since I don't have vb 3 anymore, I can't look in the db and help you guys figure it out, sorry.
Reply With Quote
  #12  
Old 12-23-2010, 11:44 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

From the database itself the exact code is:
Code:
".(($show['edit_profile']) ? ("
                       <li class=\"thead\"><a href=\"moderator.php?" . $GLOBALS['vbulletin']->session->vars['sessionurl'] . "do=useroptions&amp;u=$userinfo[userid]\">$vbphrase[edit_user_profile]</a></li>
                   ") : (""))."
--------------- Added [DATE]1293155414[/DATE] at [TIME]1293155414[/TIME] ---------------

Maybe this is a bug in the template code... if you look at the double quote following the ? it's not escaped, but every other double quote in that situation is...
Code:
<a href=\"moderator.php?"
Reply With Quote
  #13  
Old 12-24-2010, 12:00 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this:

Code:
$find = '".(($show[\'edit_profile\']) ? ("
                       <li class=\"thead\"><a href=\"moderator.php?" . $GLOBALS[\'vbulletin\']->session->vars[\'sessionurl\'] . "do=useroptions&amp;u=$userinfo[userid]\">$vbphrase[edit_user_profile]</a></li>
                   ") : (""))."';
Reply With Quote
  #14  
Old 12-24-2010, 12:57 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I got this working, kind of... saw we didn't need anything after the ? anyway so this code will add "xxxx" to the link...

Code:
$find= '<li class=\"thead\"><a href=\"moderator.php'; 

$vbulletin->templatecache['MEMBERINFO'] = str_replace($find, "xxxx" . $find, $vbulletin->templatecache['MEMBERINFO']);
You should have no problem calling your template function.
Reply With Quote
  #15  
Old 12-24-2010, 02:58 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you try the code I gave you above a a test?
Reply With Quote
  #16  
Old 12-24-2010, 03:47 AM
Digital Jedi's Avatar
Digital Jedi Digital Jedi is offline
 
Join Date: Oct 2006
Location: PopCulturalReferenceLand
Posts: 5,171
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
I got this working, kind of... saw we didn't need anything after the ? anyway so this code will add "xxxx" to the link...

Code:
$find= '<li class=\"thead\"><a href=\"moderator.php'; 

$vbulletin->templatecache['MEMBERINFO'] = str_replace($find, "xxxx" . $find, $vbulletin->templatecache['MEMBERINFO']);
You should have no problem calling your template function.
Ah, indeed that worked. For a minute there I was forgetting to change the hook to member_start.

Code:
$find= '$vbphrase[edit_user_profile]</a></li>'; 

$vbulletin->templatecache['MEMBERINFO'] = str_replace($find, $find . fetch_template(djs_delete_link), $vbulletin->templatecache['MEMBERINFO']);
Template inserted fine. Er, when I remembered to put in the correct template code.

So, that's how many names I've got to put into the Contributors field?

--------------- Added [DATE]1293169854[/DATE] at [TIME]1293169854[/TIME] ---------------

Quote:
Originally Posted by Boofo View Post
Did you try the code I gave you above a a test?
I did try that, too, with no luck. But I also read that line breaks can cause a problem. Also, when I did the manual template edit, the ") : (""))." wrapped my line of code, I presume because it was included in the show edit profile <if> condition.
Reply With Quote
  #17  
Old 12-24-2010, 04:16 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I need no such official recognition... but I would really like an answer why a question mark killed str_replace in that instance... I tried 20 things probably and nothing was working.
Reply With Quote
  #18  
Old 12-28-2010, 04:25 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BirdOPrey5 View Post
I need no such official recognition...
Ditto here - I don't expect anyone to give me credit on any mod just for helping with a question.
Reply With Quote
Reply


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 06:12 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.05442 seconds
  • Memory Usage 2,242KB
  • Queries Executed 11 (?)
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_code
  • (3)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
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete