MyBB-Plugins Forums

Full Version: Quick question about postbit layout.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello.

I'm trying to set this plugin, NewPoints, to show in postbit, where I want. I'd like to be in between reputation and warning level. In order to do this, I have added the "{$post['newpoints_postbit']}" in postbit_author_user templates. Though, it doesn't show. I have tried to look inside the plugin myself to see why it's causing this but it's a bit too complicated for me still.

Thanks.
It's not possible to do what you want without changing several things.
I have noticed that when adding "{$post['newpoints']}" it will return the points only (no links, no currency and no name), can't I find a little work around starting from this or is it really too complicated?

It's a shame if it is because I can't use the plugin as it is now. It looks horrible whether I have it a the top of postbit or whether I have it at bottom.
(01-26-2011, 02:24 AM)Bencori Wrote: [ -> ]I have noticed that when adding "{$post['newpoints']}" it will return the points only (no links, no currency and no name), can't I find a little work around starting from this or is it really too complicated?

It's a shame if it is because I can't use the plugin as it is now. It looks horrible whether I have it a the top of postbit or whether I have it at bottom.

It is not complicated for me, but for someone who doesnt' know anything about coding it might be. I don't know what's your side though. You'll have to code something to replace a code like NEWPOINTS or something else like this with the actual points. Right now it evaluates all variables and one of them being the newpoints one (formatted).
I do understand a bit PHP being a C++ coder myself, syntax is similar. But PHP being different on many sides and having all trimed out makes it harder to understand when you just overlook the code. Can't I just replace the bit where it looks for the postbit template and make it look for the other template? And tell me why doesn't it replace {$post['newpoints_postbit']} with the Newspoint regardless on where it's placed?
The user_details template is evaluated before the NewPoints' postbit function is executed (there is no way to run it before), so what you'll have to do is put an identified in your template, something like NEWPOINTS and then use str_replace in the NewPoints' template to replace the NEWPOINTS identifier with the NewPoints template from $post['message'] if I recall correctly.
(01-26-2011, 07:09 AM)Pirata Nervo Wrote: [ -> ]The user_details template is evaluated before the NewPoints' postbit function is executed (there is no way to run it before), so what you'll have to do is put an identified in your template, something like NEWPOINTS and then use str_replace in the NewPoints' template to replace the NEWPOINTS identifier with the NewPoints template from $post['message'] if I recall correctly.

Okay, I get this. Let me try.
Oh yeah. And what do you mean the NewPoint's template? I thought I have to edit the plugin directly?
Oh yes you must put the NEWPOINTS identifier in the postbit template and then run str_replace from the NewPoints' postbit function yes.
Oh, and about the str_replace() function, it needs three variables : what, by what, where.

Example from PHP.NET :

PHP Code:
str_replace("%body%""black""<body text='%body%'>"); 

So I am wondering, my function will look like :

PHP Code:
str_replace("_NEWPOINTS_"$post['message'], ??); 

How do I tell it where to replace it if you see what I mean?
After:
PHP Code:
eval("\$post['newpoints_postbit'] = \"".$templates->get('newpoints_postbit')."\";"); 

Put:
PHP Code:
$post['user_details'] = str_replace("_NEWPOINTS_"$post['newpoints_postbit'], $post['user_details']); 
Pages: 1 2