Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-01-2009, 11:11 AM
Adem GEN?'s Avatar
Adem GEN? Adem GEN? is offline
 
Join Date: Apr 2005
Location: İstanbul / T?rkiye
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 11-04-2009, 02:22 AM
RenatoMN's Avatar
RenatoMN RenatoMN is offline
 
Join Date: Nov 2008
Location: Brazil
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

if ($post[field24]) {
your code;
}
Reply With Quote
  #3  
Old 11-04-2009, 12:08 PM
Adem GEN?'s Avatar
Adem GEN? Adem GEN? is offline
 
Join Date: Apr 2005
Location: İstanbul / T?rkiye
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you very much for your help

But,
I need to work within the template code
Reply With Quote
  #4  
Old 11-06-2009, 01:32 AM
RenatoMN's Avatar
RenatoMN RenatoMN is offline
 
Join Date: Nov 2008
Location: Brazil
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
<if condition="$post[field24] OR $post[field38]">$post[field24$post[field38]<else />$post[musername]</if> 
Reply With Quote
  #5  
Old 11-06-2009, 12:18 PM
Adem GEN?'s Avatar
Adem GEN? Adem GEN? is offline
 
Join Date: Apr 2005
Location: İstanbul / T?rkiye
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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']);
Reply With Quote
  #6  
Old 11-06-2009, 07:10 PM
RenatoMN's Avatar
RenatoMN RenatoMN is offline
 
Join Date: Nov 2008
Location: Brazil
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 11-07-2009, 08:13 PM
RenatoMN's Avatar
RenatoMN RenatoMN is offline
 
Join Date: Nov 2008
Location: Brazil
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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'
)); 
Reply With Quote
  #8  
Old 11-07-2009, 08:31 PM
Adem GEN?'s Avatar
Adem GEN? Adem GEN? is offline
 
Join Date: Apr 2005
Location: İstanbul / T?rkiye
Posts: 377
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Attached Files
File Type: xml product-realname_replace_username.xml (10.0 KB, 2 views)
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 10:06 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
  • Page Generation 0.05602 seconds
  • Memory Usage 2,259KB
  • Queries Executed 12 (?)
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
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (1)postbit_attachment
  • (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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete