vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   [How-to] Add more tabs to the vB 3.7 profile pages (https://vborg.vbsupport.ru/showthread.php?t=165554)

ageurtse 12-26-2009 04:20 AM

this works also in vb4.0

ragtek 12-26-2009 06:34 AM

Not true;)

Plugin=> yes
Template not, have to be changed to the vB4 Syntax;)

ageurtse 12-27-2009 11:08 AM

what is wrong with the template.
on my test site it run's almost oke.

only when i call te tab by itself http://xxx/forums/member.php?3-Peter...cation&page=10 my custom code is way below everything what is wrong.
When i hit the mymodification tab al is displayed normal.

--------------- Added [DATE]1261950936[/DATE] at [TIME]1261950936[/TIME] ---------------

is there also a way to call a php page that should display his content in this newly created tab ?

Warlord 01-04-2010 05:37 PM

Quote:

Originally Posted by krike (Post 1881501)
just thought I would share with the people who are looking for help.

my vB version is 3.8.1

I needed to query a table I created myself to display all the tutorials of that specific user.
here is the code I used and it works like a charm

Code:

function prepare_output($id = '', $options = array())
        {
            $sql = mysql_query("SELECT * FROM tutorials WHERE approved = 1 AND user_id=".$this->profile->userinfo[userid]."");
            $test = "<ul>";
            while($result = mysql_fetch_array($sql))
            {
                $test .= "<li> <img src='http://cmstutorials.org/".$result['tutorial_thumb']."' width='50' height='50' alt='' />
                            <a href='http://cmstutorials.org/tutorial/".$result['tutorial_id']."' target='_blank'>".$result['title']."</a></li>
                        ";
            }
            $test .= "</ul>";
            $this->block_data['mymodification'] = $test;
    }

--------------- Added [DATE]1252407273[/DATE] at [TIME]1252407273[/TIME] ---------------

how do you call a specific tab with a url?

http://cmstutorials.org/forums/member.php?u=1#tabname ????

--------------- Added [DATE]1252407322[/DATE] at [TIME]1252407322[/TIME] ---------------

ok I found it http://cmstutorials.org/forums/membe...1&tab=favorite

Is tutorial_thumb a column in one of you sql tables? I'm trying to do something similar but it's really kicking my butt.

I have a form users submit their resume's on. It saves it to the database in the table formresults. The information I want to display on the profile is located in a column labeled output in the formresults table.

Below is the code I'm using in the member_build_blocks_start hook location.

Code:

$blocklist = array_merge($blocklist, array(
    'resume' => array(
        'class' => 'Resume',
        'title' => 'Resume',
        'hook_location' => 'profile_left_last'
    )
));

class vB_ProfileBlock_resume extends vB_ProfileBlock
{
  var $template_name = 'memberinfo_block_resume';
  function confirm_empty_wrap()
  {
    return false;
  }
  function confirm_display()
  {
    return ($this->block_data['resume'] != '');
  }
        function prepare_output($id = '', $options = array())
{
        global $db;
        $sql= $db->query_read("SELECT output FROM " . TABLE_PREFIX . "formresults WHERE userid = '.$this->profile->userinfo[userid].' AND title = 'Resume' ");
            $test = "<div>";
            while($result = mysql_fetch_array($sql))
            {
                $test .= "'.$result['output'].'"
                        ";
            }
            $test .= "</div>";


    $this->block_data['resume'] = $test;
  }
}

I think the code in bolded red is the part I'm getting lost on?

I get this error when displaying the memberinfo profile page.

Quote:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/righscom/public_html/addons/projectfanboy/vb/member.php(463) : eval()'d code on line 249

Warlord 01-05-2010 07:57 PM

Anyone?

Lynne 01-05-2010 08:45 PM

Quote:

Originally Posted by Warlord (Post 1948169)
Anyone?

Too many quotes in this 'line':
PHP Code:

                $test .= "'.$result['output'].'"
                        "; 


Warlord 01-05-2010 11:51 PM

Quote:

Originally Posted by Lynne (Post 1948211)
Too many quotes in this 'line':
PHP Code:

                $test .= "'.$result['output'].'"
                        "; 



I see what you're talking about, thanks for that. While there was some syntax error there, unfortunately it didn't solve my problem. I changed it to this:

PHP Code:

                $test .= " .$result['output']. "

I'm still getting the same error though:

Quote:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/righscom/public_html/addons/projectfanboy/vb/member.php(463) : eval()'d code on line 249
I thought maybe I was just calling the column in the table contained in the array incorrectly, which gave me the error, but you didn't mention that, so can I assume that if the column in the table is called output that this would be the correct way to retrieve that data?

PHP Code:

$result['output'


dartho 01-05-2010 11:58 PM

shouldn;'t it just be :
PHP Code:

$test .= $result['output']; 

?

of if you wanted a space after each result

PHP Code:

$test .= $result['output'] . " "


Warlord 01-06-2010 12:11 AM

Quote:

Originally Posted by dartho (Post 1948346)
shouldn;'t it just be :
PHP Code:

$test .= $result['output']; 


Thank you, that got rid of the annoying error. I really could've sworn I had tried that before but apparently not. :confused:

The Resume tab shows up now, unfortunately there is still no data in it. Could it be the type of data that's in there (a mixture of html and php variables) causing it to not show up?

--------------- Added [DATE]1262744048[/DATE] at [TIME]1262744048[/TIME] ---------------

Hmmm... I guess not. I changed the data in there to be just the string "This is only a test" and still nothing shows up. :confused:

--------------- Added [DATE]1262744441[/DATE] at [TIME]1262744441[/TIME] ---------------

HOLY CRAP! I'm almost there! I've been working on this for like a week and I was almost ready to give up but now I'm ALMOST THERE! :D :D :D

The problem was the SQL query was returning no results because apparently this line of code doesn't work the way I thought it did.

PHP Code:

.$this->profile->userinfo[userid]. 

I changed that to my userid and it worked! Now I just need to figure out the right way to call for the user profile id! :D Thanks everyone!

--------------- Added [DATE]1262745188[/DATE] at [TIME]1262745188[/TIME] ---------------

Quote:

Originally Posted by Warlord (Post 1948356)
HOLY CRAP! I'm almost there! I've been working on this for like a week and I was almost ready to give up but now I'm ALMOST THERE! :D :D :D

The problem was the SQL query was returning no results because apparently this line of code doesn't work the way I thought it did.

PHP Code:

.$this->profile->userinfo[userid]. 

I changed that to my userid and it worked! Now I just need to figure out the right way to call for the user profile id! :D Thanks everyone!

Okay, apparently it does work the way I thought it did, I just had removed the extra " because I thought it was wrong. I still don't quite understand why it should be there but it seems to work now! Woohoo! :D:D:D

For anyone who's interested in what the code looked like that finally ended up working, here it is. :D

PHP Code:

$blocklist array_merge($blocklist, array(
    
'resume' => array(
        
'class' => 'Resume',
        
'title' => 'Resume',
        
'hook_location' => 'profile_left_last'
    
)
));

class 
vB_ProfileBlock_resume extends vB_ProfileBlock
{
  var 
$template_name 'memberinfo_block_resume';
  function 
confirm_empty_wrap()
  {
    return 
false;
  }
  function 
confirm_display()
  {
    return (
$this->block_data['resume'] != '');
  }
    function 
prepare_output($id ''$options = array())
{
    global 
$db;
    
$sql$db->query_read("SELECT * FROM " TABLE_PREFIX "formresults WHERE title = 'Resume' AND userid=".$this->profile->userinfo[userid]."");

            
$test "<div>";
            while(
$result mysql_fetch_array($sql))
            {
$test .= $result['output'];  
            }
            
$test .= "</div>";


    
$this->block_data['resume'] = $test;
  }



Warlord 01-13-2010 11:40 PM

Is there something else you have to do to add more pages? When I repeat the steps I did to create the first tab the new tab I create replaces the first tab I created instead of appearing next to it. :confused:


All times are GMT. The time now is 07:31 PM.

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.01573 seconds
  • Memory Usage 1,786KB
  • 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
  • (2)bbcode_code_printable
  • (10)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete