![]() |
php plugin
how to include this php code to vbulletin ? i think wirh plugin and Global start but inst working like that. this script should only be at the showthread.php
function: if the user is logged in. That special link is disepearing from all post. PHP Code:
|
need help here!
|
You couldn't do that in global start I don't believe. You just dont want links to work at all?
|
Quote:
|
`no ideas?
|
need help -.-
--------------- Added [DATE]1257600267[/DATE] at [TIME]1257600267[/TIME] --------------- help me Oo? |
if(THIS_SCRIPT == showthread)
{ your code here } |
with global start or what?
like that? PHP Code:
|
You are using template conditions in a plugin and that is not going to work. Plugins must only use php. Instead of:
PHP Code:
PHP Code:
|
ah ok, then like that? (what about the </else> ) Oo
if(THIS_SCRIPT == showthread) { if ($vbulletin->userinfo['userid']) { function callback($buffer) { return (str_replace("http://example.com", "", $buffer)); } ob_start("callback"); {else /} } } |
Why do you want and else when the else has nothing in it? Just leave it out if you aren't going to do a thing. (Also, please post code in code tags, it's too hard to read otherwise.)
|
it is not working! also not working with with global start and showtheard start....
can you test it please >.> PHP Code:
|
help pls!!???? i have ti get it work!
|
If that is all you have in your plugin, then you will get an error since your parenthesis don't add up (you are missing an ending parenthesis).
|
ok with the end parenthesis } it still not replacing the http://example.com link -.-
can you please test it ? :( PHP Code:
|
No, I can't test it. I have no idea where it is supposed to get $buffer from. Exactly what are you trying to do? Just replace a link in a post for one userid? Why a function? Why aren't you just using str_replace for the $post['message']?
|
Quote:
in other words: its searching the whole site for "http://example.com" and replace replace it with nothing! how you would do that using str_replace for the $post['message']? please show me your code. what i need is to replace all "http://example.com" to nothing in all posts if the user is logged in! |
WHY it isnt working???
|
Are you caching the posts? It could be you have caching on and so it isn't working for those cached posts.
|
nope it still isnt working , ive deleted the postcache..
|
why?
|
on normal site this code is working why not n the forum omg? oO
|
Instead of your plugin using global_start, try using this on global_complete:
Code:
$output = str_replace("example.com", "", $output); but it does seem kind of dangerous (and slower) to replace it globally on the entire output, it would be better to figure out where to do it just for the post contents. |
Quote:
you mean this code could make it faster? or please give me a better solution i have a big forum so every slow plugin is bad. PHP Code:
|
Yeah, you would defintely want to check "THIS_SCRIPT" if you only want it to work on that one page.
To be honest, while it's obviously wise to avoid any unnecessary operations (like checking the entire output when you only need to check the post contents), I don't know that it's enough to be worried about compared to everything else that's going on. If I get a chance I'll look to see if there's a hook to check only the posts. I think I looked a couple days ago and couldn't figure it out, but I'll check again. --------------- Added [DATE]1258761881[/DATE] at [TIME]1258761881[/TIME] --------------- OK, you got me curious so I had to go figure it out. :) You could use: Code:
global $vbulletin; for the plugin code, and use the "postbit_display_complete" hook, to do it only for posts. This won't do the post titles, if you want the replacement in the titles you'd have to add a second str_replace line for that. (Also I don't think you need to check THIS_SCRIPT this way). BTW, this is what Lynne suggested back in post #16... |
Good job kh99 ! working perfect. we thank you :)
|
All times are GMT. The time now is 03:25 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|