Announcement

Collapse
No announcement yet.

Vbulletin 4 : how to display User Profile Fields(Multiple-Selection) in other pages.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Forum] Vbulletin 4 : how to display User Profile Fields(Multiple-Selection) in other pages.

    Hi all

    I am trying to change the template and display the user profile fields on other pages.
    I created a plugin and get the value from $vbulletin->userinfo[field*]; and register it to the template. somegthings like below. but the problem is, it works fine for text field, but for selection field, it will display a number, not the selected text data. any idea how do i display the selected text??

    PHP Code:
    $postcode $vbulletin->userinfo[field9];
    vB_Template::preRegister('navbar',array('postcode' => $postcode)); 

  • #2
    What you probably want to do is in your plugin, define the text you want to display. Something like:

    PHP Code:
    if ($vbulletin->userinfo[field9] == '1'$postcode 'Cat';
    else if (
    $vbulletin->userinfo[field9] == '2'$postcode 'Dog';
    else if (
    $vbulletin->userinfo[field9] == '0'$postcode '';

    vB_Template::preRegister('navbar',array('postcode' => $postcode)); 

    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools <- awesome site for html/css help

    Comment


    • #3
      Thanks for the reply, in this case, if i changed the field content, for example added another option fish, i have to change from my plugin as well
      how is the vbulletin link the number to the text? i did a print_r($vbulletin) output, but i can't see the select text(cat, dog etc) anywhere. it displays ok for vbulletin build-in profile editor





      Originally posted by Lynne View Post
      What you probably want to do is in your plugin, define the text you want to display. Something like:

      PHP Code:
      if ($vbulletin->userinfo[field9] == '1'$postcode 'Cat';
      else if (
      $vbulletin->userinfo[field9] == '2'$postcode 'Dog';
      else if (
      $vbulletin->userinfo[field9] == '0'$postcode '';

      vB_Template::preRegister('navbar',array('postcode' => $postcode)); 

      Comment


      • #4
        What type of profile field did you create?

        Have you read this - How To Add A Profile Field To The Postbit

        Please don't PM or VM me for support - I only help out in the threads.
        vBulletin Manual & vBulletin 4.0 Code Documentation (API)
        Want help modifying your vbulletin forum? Head on over to vbulletin.org
        If I post CSS and you don't know where it goes, throw it into the additional.css template.

        W3Schools <- awesome site for html/css help

        Comment


        • #5
          Thank you

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...
          X