View Full Version : Can you help?
Adem GEN?
11-01-2009, 11:11 AM
Hello,
Real name surname instead of the user name
Here is the error?
$username_yerine_ad_soyad['postbit']['find'] = array('$post[musername]');
$username_yerine_ad_soyad['postbit']['replace'] = Array('$post[field24] $post[field38]');
$vbulletin->templatecache['postbit'] = str_replace($username_yerine_ad_soyad['postbit']['find'], $username_yerine_ad_soyad['postbit']['replace'], $vbulletin->templatecache['postbit']);
Add New Plugin
Hook Location: ??????? Here, what should I choose?
Thank you
--------------- Added 01 Nov 2009 at 15:42 ---------------
Okay, I solved the problem
Hook Location: parse_templates
Rate correct?
--------------- Added 01 Nov 2009 at 15:55 ---------------
There was a problem
Username show if it is empty Real Name and Surname
How do I do?
RenatoMN
11-04-2009, 02:22 AM
if ($post[field24]) {
your code;
}
Adem GEN?
11-04-2009, 12:08 PM
Thank you very much for your help
But,
I need to work within the template code
RenatoMN
11-06-2009, 01:32 AM
<if condition="$post[field24] OR $post[field38]">$post[field24] $post[field38]<else />$post[musername]</if>
Adem GEN?
11-06-2009, 12:18 PM
Not work to plugin
But
Worked smoothly in the template
Here is the error? (RED)
$username_yerine_ad_soyad['postbit_legacy']['find'] = array('$post[musername]');
$username_yerine_ad_soyad['postbit_legacy']['replace'] = Array('<if condition=\"$post[' . $vbulletin->options['username_yerine_ad_field'] . ']\">$post[' . $vbulletin->options['username_yerine_ad_field'] . '] $post[' . $vbulletin->options['username_yerine_soyad_field'] . ']<else />$post[musername]</if>');
$vbulletin->templatecache['postbit_legacy'] = str_replace($username_yerine_ad_soyad['postbit_legacy']['find'], $username_yerine_ad_soyad['postbit_legacy']['replace'], $vbulletin->templatecache['postbit_legacy']);
RenatoMN
11-06-2009, 07:10 PM
When replacing only 1 value, do not need to use arrays as search/replace values (see str_replace manual (http://php.net/str_replace)).
Also, if you're using a plugin, you may check the existence of content in $post[field24] and $post[field38] and, only if true, perform the replacement:
Use the hook postbit_display_complete:
if ($post[field24] OR $post[field38]) {
$vbulletin->templatecache['postbit_legacy'] = str_replace('$post[musername]','$post[field24] $post[field38]',$vbulletin->templatecache['postbit_legacy']);
}
Regards
RenatoMN
11-07-2009, 08:13 PM
Hello.
I replied your PM:
May you please continue answering in the thread, please?
Answer there, in simply words:
- what you have in field24?
- what you have in field38?
- when you want to replace 'musername' (and replace with what)?
But I will complete the question:
why aren't you caching the templates (in the zip file you sent me)? is this working the way it is now?
I never used hooks in "parse_templates", this is why i'm asking.
When using other hooks, I had to determine the caching of templates in a plugin, for the hook "cache_templates":
$globaltemplates = array_merge($globaltemplates, array(
'postbit',
'postbit_legacy',
'postbit_first',
'otherstemplates'
));
Adem GEN?
11-07-2009, 08:31 PM
I'm beginner
I am learning slowly
know very little php
I would do something for myself
My goal, areas as possible within the forum to show their real name instead of username
I've created a custom profile fields
Real Name and Real Surname
Members in this area are entered into the real names and surnames
field24-->Real Name (Adem)
field38-->Real Surname (GENÇ)
I'm trying to make plugin
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.