Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-23-2012, 10:27 AM
Bioman2k Bioman2k is offline
 
Join Date: Dec 2003
Location: France
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Add profile fields in the stats section (Forumhome)

Hello,

In the forumhome, we have by default a row like that :
"Welcome to our new member, [NAME]"

I added new custom profile fields and I would like add these after to be more accurate.
"Welcome to our new member, [NAME], [Field1] - [Field2] [Field3] - [Field4]"

How can I do that modification ?
Thank you in advance.

Have a nice day,
Reply With Quote
  #2  
Old 09-23-2012, 12:42 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The username and id of the newest user is already available, but the other fields aren't, so you'd have to look them up. You could use a plugin on hook forumhome_complete to look up the fields for the user with id $newuserinfo['userid'], and either add them to the $newuserinfo array or preRegister a new variable to the FORUMHOME template. Then of course you'd need to edit the FORUMHOME template to display the fields.
Reply With Quote
  #3  
Old 09-23-2012, 12:52 PM
Bioman2k Bioman2k is offline
 
Join Date: Dec 2003
Location: France
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I understand what you mean but i'm novice in PHP.
Could you help me please ?
Reply With Quote
  #4  
Old 09-23-2012, 01:04 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, try this: create a new plugin using hook forumhome_complete and this code:

Code:
if (is_array($newuserinfo))
{
    $newuserinfo = array_merge($newuserinfo, fetch_userinfo($newuserinfo['newuserid']));
}

Then edit the FORUMHOME template and find welcome_to_our_newest_member_x (which is the existing phrase), and add {vb:var newuserinfo.fieldX} (once for each field) where you want to add the new fields.
Reply With Quote
  #5  
Old 09-23-2012, 01:24 PM
Bioman2k Bioman2k is offline
 
Join Date: Dec 2003
Location: France
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for your help.

I've done everything but I have the following error in forumhome and the welcome raw in the footer disappears :

Code:
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in [path]/forum.php(787) : eval()'d code on line 3
Any idea ?
Attached Images
File Type: png 01.png (44.4 KB, 0 views)
File Type: jpg abc.jpg (53.3 KB, 0 views)
Reply With Quote
  #6  
Old 09-23-2012, 08:34 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh, sorry, I guess it should be
Code:
if (is_array($newuserinfo) AND $newuserinfo['userid'] > 0)
{
    $newuserinfo = array_merge($newuserinfo, fetch_userinfo($newuserinfo['userid']));
}

and sorry it took so long to get back to you.
Reply With Quote
  #7  
Old 09-23-2012, 09:05 PM
Bioman2k Bioman2k is offline
 
Join Date: Dec 2003
Location: France
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for all your help.

Your new plugin code hasn't error but I can't see my fields.
You'll see in the attached files the result.

In FORUMHOME, I have put this code :

Code:
<p>{vb:rawphrase welcome_to_our_newest_member_x, {vb:link member, {vb:raw newuserinfo}}, {vb:raw newuserinfo.username} {vb:var newuserinfo.field12} {vb:var newuserinfo.field14} {vb:var newuserinfo.field11} {vb:var newuserinfo.field15}}</p>
Thank you.
Attached Images
File Type: png 01.png (14.0 KB, 0 views)
Reply With Quote
  #8  
Old 09-23-2012, 09:26 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think the problem is that you have the new fields inside the phrase tag, as phrase parameters. You could actually do that if you wanted, but you'd have to edit the phrase and add {3}, {4}, {5} where you want the new fields to show up.

But the easiest thing to do would just be to move them outside the phrase curly tag like:

Code:
<p>{vb:rawphrase welcome_to_our_newest_member_x, {vb:link member, {vb:raw newuserinfo}}, {vb:raw newuserinfo.username}} {vb:var newuserinfo.field12} {vb:var newuserinfo.field14} {vb:var newuserinfo.field11} {vb:var newuserinfo.field15}</p>
Reply With Quote
  #9  
Old 09-24-2012, 06:35 AM
Bioman2k Bioman2k is offline
 
Join Date: Dec 2003
Location: France
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It works like a charm !
Thank you so much for all your help.

Have a nice day.
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:04 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.11970 seconds
  • Memory Usage 2,260KB
  • 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
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (3)postbit_attachment
  • (9)postbit_onlinestatus
  • (9)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