vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Add profile fields in the stats section (Forumhome) (https://vborg.vbsupport.ru/showthread.php?t=288202)

Bioman2k 09-23-2012 10:27 AM

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,

kh99 09-23-2012 12:42 PM

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.

Bioman2k 09-23-2012 12:52 PM

Ok I understand what you mean but i'm novice in PHP.
Could you help me please ?

kh99 09-23-2012 01:04 PM

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.

Bioman2k 09-23-2012 01:24 PM

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

kh99 09-23-2012 08:34 PM

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.

Bioman2k 09-23-2012 09:05 PM

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

kh99 09-23-2012 09:26 PM

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>

Bioman2k 09-24-2012 06:35 AM

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

Have a nice day.


All times are GMT. The time now is 06:44 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.01240 seconds
  • Memory Usage 1,723KB
  • 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
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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