vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Can you help? (https://vborg.vbsupport.ru/showthread.php?t=227181)

Adem GEN? 11-01-2009 11:11 AM

Can you help?
 
Hello,

Real name surname instead of the user name


Here is the error?
PHP Code:

$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

PHP Code:

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

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:

PHP Code:

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:

Quote:

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":

PHP Code:

$globaltemplates array_merge($globaltemplates, array(
'postbit',
'postbit_legacy',
'postbit_first',
'otherstemplates'
)); 


Adem GEN? 11-07-2009 08:31 PM

1 Attachment(s)
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


All times are GMT. The time now is 04:29 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.01305 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete