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)

Wired1 05-12-2008 02:10 AM

Anyone gotten the Edit stuff to work on new tabs? Only messed with it for a couple of min myself while working on updating my mods.

kinggori 05-13-2008 08:14 PM

Thanks for the awesome article :) Gave it 5/5 :)

Quick question... how can I have a link that goes (displays) directly to the new tab I created instead of the contents of the first tab on the list?

tafreeh 05-15-2008 06:24 PM

OMG this is soo confusing, is there any easier way to do it ?

Wired1 05-15-2008 06:52 PM

It's pretty easy actually. Pop in the 2 quotes in the article, and that's it.

If you just want a tab for a profile category, that's built in.

soulface 05-19-2008 06:42 AM

Nice article, works fine. But can anyone tell me how I can call a custom templates for data into that tab ?

craiovaforum 05-19-2008 06:12 PM

thanks ;)

Code Monkey 05-20-2008 07:57 PM

So what's the deal with phrases? It seems only GLOBAL phrases work in blocks no matter what you put in the new class. Even if the phrasegroup shows as available for the page. So there must be some issue with scope here that isn't cured by a mere addition of "global $vbphrase;".

DieselTruck 05-23-2008 12:02 AM

How can I disable the new tab for all usergroups but one?

XTF 05-28-2008 11:20 AM

I've simplified the following code fragment a bit.
Code:

$blocklist['mymodification'] = array
(
                'class' => 'MyModification',
                'title' => 'My Modification',
                'hook_location' => 'profile_left_last'
);

How do I access for example $userinfo inside prepare_output()? I've used global $userinfo, but that doesn't seem to do the trick.

intrigue 05-28-2008 04:11 PM

Awesome thanks very much this has answered one question at least
Matt

Code Monkey 05-28-2008 04:54 PM

Quote:

Originally Posted by XTF (Post 1533959)
I've simplified the following code fragment a bit.
Code:

$blocklist['mymodification'] = array
(
        'class' => 'MyModification',
        'title' => 'My Modification',
        'hook_location' => 'profile_left_last'
);

How do I access for example $userinfo inside prepare_output()? I've used global $userinfo, but that doesn't seem to do the trick.

Presuming you are referring to the user info of the profile and not the viewer.
Code:

$this->profile->userinfo

XTF 05-31-2008 12:10 PM

Thanks. Do I have to use $block_data to pass variables to the template or can I use arbitrary variable names?
This code seems to be more complex than needed.

Code Monkey 06-02-2008 05:43 AM

Quote:

Originally Posted by XTF (Post 1536996)
Thanks. Do I have to use $block_data to pass variables to the template or can I use arbitrary variable names?
This code seems to be more complex than needed.

I'm still working all that out. It appears that you can use variables when you eval your own templates but you need to use the $this->block_data array for passing things to the main template.

Wired1 06-09-2008 05:37 AM

Has anyone using a custom tab stumbled upon the bit of code that allows you to link directly to a tab, like so:

http://www.domain.com/member.php?u=1&tab=contactinfo

I'm thinking there's some java code somewhere doing it (I believe the tabs are AJAX), but haven't found the right bit just yet.

intrigue 06-09-2008 09:04 AM

Quote:

Originally Posted by Wired1 (Post 1544733)
Has anyone using a custom tab stumbled upon the bit of code that allows you to link directly to a tab, like so:

http://www.domain.com/member.php?u=1&tab=contactinfo

I'm thinking there's some java code somewhere doing it (I believe the tabs are AJAX), but haven't found the right bit just yet.

funnily enough i need to do the same thing.

Matt

ruhrpottforum 07-10-2008 06:00 PM

For some hours I try to get photopost pro latest addition to members gallery into a new tab but for some reason (a hook?) it didn't work - it will only work if I place the code in that MEMBERINFO template ...

MissKalunji 08-06-2008 10:20 AM

how would that work if i want to add a varibable like for ishop?

$ishop example? that's the code below

Quote:

<!-- show inventory -->
<fieldset><legend><a href="ishop.php?do=ViewMember&id=$userinfo[userid]" title="$userinfo[username]'s Inventory">$userinfo[username]'s Inventory</a></legend>
<div>
$userinfo[invrow]
<br>
</div>
</fieldset>
<!-- /show inventory -->

yingzhou 08-06-2008 11:04 AM

Quote:

Originally Posted by MissKalunji (Post 1592511)
how would that work if i want to add a varibable like for ishop?

$ishop example? that's the code below

can't do this! :mad:

MissKalunji 08-06-2008 09:12 PM

i can't?

MissKalunji 08-10-2008 04:15 PM

Got it working! thanks

milla da killa 09-01-2008 09:39 PM

Code:


$blocklist = array_merge($blocklist, array(
        'playlist' => array(
                'class' => 'Playlist',
                'title' => 'Playlist',
                'hook_location' => 'profile_left_last'
        )
));

class vB_ProfileBlock_playlist extends vB_ProfileBlock
{
        var $template_name = 'memberinfo_block_playlist';

        function confirm_empty_wrap()
        {
                return false;
        }

        function confirm_display()
        {
                return ($this->block_data['playlist'] != '');
        }

        function prepare_output($id = '', $options = array())
        {
                $this->block_data['playlist'] = '<div style="text-align: center; margin-left: auto; visibility:visible; margin-right: auto; width:450px;"><embed style="width:435px; visibility:visible; height:270px;" allowScriptAccess="never" src="http://www.greatprofilemusic.com/mc/mp3player-othersite.swf?config=http://www.greatprofilemusic.com/mc/config/config_black_shuffle.xml&mywidth=435&myheight=270&playlist_url=http://www.greatprofilemusic.com/loadplaylist.php?playlist='$this->profile->userinfo[field7]'" menu="false" quality="high" width="435" height="270" name="mp3player" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" border="0"/> </div>';
        }
}

I've tried everything, anyone got any suggestions?

Darkwaltz4 09-10-2008 06:05 AM

heh, what would be stellar is a tutorial on creating your own fancy tab thing on other pages :p

jgeorge123 09-22-2008 09:31 PM

Hi there and i am trying to, i am not that good at describing the code but what i am trying acheive is that - i need to get some data from a the database and show in one of the block. Have a look at my code

PHP Code:

$blocklist array_merge($blocklist, array( 
    
'games' => array( 
        
'class' => 'games'
        
'title' => 'gamess'
        
'hook_location' => 'profile_left_last' 
    

)); 

// ######################### REQUIRE BACK-END ############################ 
require_once('./global.php'); 
global 
$vbulletin
class 
vB_ProfileBlock_games extends vB_ProfileBlock 

    var 
$template_name 'memberinfo_block_games'

    function 
confirm_empty_wrap() 
    { 
        return 
false
    } 

    function 
confirm_display() 
    { 
        return (
$this->block_data['games'] != ''); 
    } 

    function 
prepare_output($id ''$options = array()) 
    { 
        function 
sql_most_downloaded ($limit
        { 
            global 
$vbulletin$vbphrase
            
$sql $db->query 
                

                    
'SELECT * FROM xxx Where xxx = 'xxx'
                    GROUP BY xxx 
                    ORDER BY xxx DESC 
                    LIMIT x,x' 
                
); 
            while (
$games $db->fetch_array($sql)) 
                { 
                    
$out.= '<li><a href=\"../games/gamess/show/' $games[ID] . '\" title=\"' $games[file_title] . '\">' $games[file_title] . ' [ ' $games[total_downloads] . ' ]</a></li>'
                } 
        } 

        
$this->block_data['games'] = $out
    } 


This selection of data is not based on the vbulletin so i think i can't use
PHP Code:

this->something->something 

Has anyone have any suggestion

CypherSTL 09-29-2008 09:15 PM

1 Attachment(s)
Is anyone else having the problem of custom profile tabs not parsing BB Code?

It displays normal HTML correctly, but not BBCode.

jerx 10-27-2008 03:26 AM

I am trying to output pictures from coppermine gallery in a tab. There is a script for coppermine gallery called cpmfetch, which allows to display any picture of your coppermine gallery on external pages. All you need to do is put this into your php page:

PHP Code:

<?php
 
require_once "./coppermine_gallery/cpmfetch/cpmfetch.php";
 
$objCpm = new cpm("./coppermine_gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewLastAddedMedia(1,1,$options);
 
$objCpm->cpm_close();
?>

This will add the following code to that page location, which represents the last picture added to your coppermine gallery:

Code:

<table  >

<tr>

<td><a href='http://your_domain.com/coppermine_gallery/thumbnails.php?album=14' ><img src="http://your_domain.com/coppermine_gallery/albums_directory/categoryname/picture_name.jpg" /></a></td>

</tr>


</table>

When I add the following code for my profile tab, that picture will be shown at the very beginning of the profile page - even before doctype, header and body tags.

Code:

$blocklist = array_merge($blocklist, array(
        'copperminegallery' => array(
                'class' => 'CoppermineGallery',
                'title' => 'Last Added Pic',
                'hook_location' => 'profile_left_last'
        )
));

class vB_ProfileBlock_CoppermineGallery extends vB_ProfileBlock
{
        var $template_name = 'memberinfo_block_copperminegallery';

        function confirm_empty_wrap()
        {
                return false;
        }

        function confirm_display()
        {
                return ($this->block_data['copperminegallery'] != '');
        }

        function prepare_output($id = '', $options = array())
        {
include "./coppermine_gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./coppermine_gallery/cpmfetch/cpmfetch_config.php");
                $this->block_data['copperminegallery'] = $objCpm->cpm_viewLastAddedMedia(1,1,$options);
        }
}

When I add the resulting html code manually into the block it works fine:

Code:

$blocklist = array_merge($blocklist, array(
        'copperminegallery' => array(
                'class' => 'CoppermineGallery',
                'title' => 'My Favs',
                'hook_location' => 'profile_left_last'
        )
));

class vB_ProfileBlock_CoppermineGallery extends vB_ProfileBlock
{
        var $template_name = 'memberinfo_block_copperminegallery';

        function confirm_empty_wrap()
        {
                return false;
        }

        function confirm_display()
        {
                return ($this->block_data['copperminegallery'] != '');
        }

        function prepare_output($id = '', $options = array())
        {
include "./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
                $this->block_data['copperminegallery'] = '<table  >

<tr>

<td><a href=\'http://your_domain.com/coppermine_gallery/thumbnails.php?album=14\' ><img src="http://your_domain.com/coppermine_gallery/albums_directory/categoryname/picture_name.jpg" /></a></td>

</tr>


</table>
';
        }
}

I had to put a backslash in front of ' to avoid the following error. But I don' t think that this is the problem, because there is no error with the real code.

Quote:

Parse error: syntax error, unexpected T_STRING in /path/to/your/web/root/member.php(454) : eval()'d code on line 250
Does anyone know how to correct the display problem?

Thank you!

Wordplay 11-17-2008 09:16 AM

great! thanks a lot!

is there a way to have a preview of the latest threads and posts made by a user the way they have it on ipb in those tabs:
http://forums.invisionpower.com/inde...showuser=75430

i actually requested that as a mod:
https://vborg.vbsupport.ru/showthread.php?t=196487

Bilderback 11-18-2008 09:02 PM

Great Article.
Code:

'hook_location' => 'profile_left_last'
Does anyone know how to provide the hook location when defined by the admincp?
My product has setting options like seen below:
Code:

<setting varname="custom_hook_location" displayorder="20">
    <datatype>free</datatype>
    <optioncode><![CDATA[select:piped
0|None
1|$template_hook[profile_left_first]
2|$template_hook[profile_left_last]
]]></optioncode>
    <defaultvalue>0</defaultvalue>
</setting>

I am trying to display the block from whichever is chosen in admincp.
Have tried the following with no luck-
custom_hook_location
$vbulletin->options['custom_hook_location']

Thanks

fabs_pim 11-22-2008 11:22 AM

How do I display a list which i want to get out of an mysql database in such a profile tab?

Lynne 11-22-2008 03:45 PM

Quote:

Originally Posted by fabs_pim (Post 1670579)
How do I display a list which i want to get out of an mysql database in such a profile tab?

You'll need to add your query into the plugin and then spit the results out into "$this->block_data['mymodification']"

DragonBlade 01-25-2009 06:37 AM

Hey, I'm trying to test this out and see if I can make something cool for my members, but I've noticed something a bit weird...

For the template, I've got the following code:
Code:

<if condition="$vbulletin->userinfo['userid'] == 15010">
<div class="alt1 block_row">
        <ul class="list_no_decoration">
                $block_data[animelist]
        </ul>
</div>
</if>

The conditional is there because, as I said, I'm testing it out and don't want all my members to see it yet, just me. However, after not getting it to display and a bit of tinkering around, I've found out that the $vbulletin object does not exist as far as the template is concerned. I've tried these variations to be sure:
Code:

<if condition="$vbulletin->userinfo['userid'] == 15010">
<if condition="$vbulletin->userinfo['userid']">
<if condition="$vbulletin->userinfo">
<if condition="$vbulletin">
<if condition="1">

The last one DID work, of course.

How would I make it so that the $vbulletin object IS recognized?




EDIT: BTW, I did "solve" it simply by putting the plugin itself in some "IF" brackets, but still for curiosity's sake, let's say for some reason I wanted to use the $vbulletin object in the tab (maybe I wanted to make a Tab with the User's name or something equally silly).

Lynne 01-25-2009 04:19 PM

Make $vbulletin global in the plugin.

Cledus James 02-03-2009 01:53 PM

Ok, this might have been answered before, but it seems I'm doing something wrong. I'm trying to add a new tab and display a custom profile field (field24) in it. Here's my plugin code:

Code:

$blocklist = array_merge($blocklist, array(
        'mymodification' => array(
                'class' => 'MyModification',
                'title' => 'My Modification',
                'hook_location' => 'profile_left_last'
        )
));

class vB_ProfileBlock_MyModification extends vB_ProfileBlock
{
        var $template_name = 'memberinfo_block_mymodification';

        function confirm_empty_wrap()
        {
                return false;
        }

        function confirm_display()
        {
                return ($this->block_data['mymodification'] != '');
        }

        function prepare_output($id = '', $options = array())
    {
 
        $this->block_data['mymodification'] = $this->profile->userinfo['field24'] : "Stuff: $this->profile->userinfo['field24']" ? "Nothing to see here";
    }
}
}

But when I add this I get an error on the website page:

Quote:

Parse error: parse error, unexpected ':' in /home/url/forums/member.php(464) : eval()'d code on line 26

Fatal error: Cannot instantiate non-existent class: vb_profileblock_myawards in /home/url/forums/includes/class_profileblock.php on line 64
When I ad just the original plugin code I don't get the error, but as soon as I try and replace the $this code it gives me the error. Wondering if anyone could be of any help. I'm a vBulletin newb. What am I doing wrong? Thanks.

Dinatius 02-05-2009 07:32 PM

Cledus: The ?: is in the wrong order. It should be:
Code:

$this->block_data['mymodification'] = $this->profile->userinfo['field24'] ? "Stuff: $this->profile->userinfo['field24']" : "Nothing to see here";

On another topic, for anyone interested, and to get some feedback on whether this is done properly:

I wanted to get mysql data on my new tab, and $db and $vbulletin->db didn't work - they aren't around when this code gets called. In the class_profileblock.php file, when it's building the static blocks such as user statistics and buddy list, it uses this:
Code:

$this->registry->db
It gets me the info, so it works, but is there a preferable way to do it?

Edit: $this->registry seems to be the same as $vbulletin elsewhere...

Cledus James 02-06-2009 01:21 PM

Quote:

Originally Posted by Dinatius (Post 1735484)
Cledus: The ?: is in the wrong order. It should be:
Code:

$this->block_data['mymodification'] = $this->profile->userinfo['field24'] ? "Stuff: $this->profile->userinfo['field24']" : "Nothing to see here";


Ok, I updated it and it did fix the error, but it still didn't display the field. It displayed:

Quote:

Stuff: Object->userinfo['field24']
in the profile tab. What should I do to display the content of the my custom profile field 24.

So here's my plugin right now:

Code:

$blocklist = array_merge($blocklist, array(
        'mymodification' => array(
                'class' => 'MyModification',
                'title' => 'My Modification',
                'hook_location' => 'profile_left_last'
        )
));

class vB_ProfileBlock_MyModification extends vB_ProfileBlock
{
        var $template_name = 'memberinfo_block_mymodification';

        function confirm_empty_wrap()
        {
                return false;
        }

        function confirm_display()
        {
                return ($this->block_data['mymodification'] != '');
        }

        function prepare_output($id = '', $options = array())
    {
 
        $this->block_data['mymodification'] = $this->profile->userinfo['field24'] ? "Stuff: $this->profile->userinfo['field24']" : "Nothing to see here";
    }
}

By the way, thanks for the reply.

Lynne 02-06-2009 02:01 PM

Have you tried to see if your plugin is even working by doing something simple like:

PHP Code:

$this->block_data['mymodification'] = 'This is a test'

OR, see if the profile field is even available there:
PHP Code:

$this->block_data['mymodification'] = '$this->profile->userinfo['field24']'


Dinatius 02-06-2009 04:19 PM

Oops, wasn't looking at the rest of the code. Array values need to be appended, can't be parsed inside quotes like a normal $variable:
Code:

$this->block_data['mymodification'] = $this->profile->userinfo['field24'] ? "Stuff: ".$this->profile->userinfo['field24'] : "Nothing to see here";
Alternately, you can put that array value in a variable and put that in quotes, although I'm not sure what that would do to the ?: selector. If it works, it makes things easier to read... Example:
Code:

$field24=$this->profile->userinfo['field24'];
$this->block_data['mymodification'] = $field24 ? "Stuff: $field24" : "Nothing to see here";

I'm only intermediate at PHP, too, so I'm not sure how that would affect performance (also depends how heavily the page is used)

(p.s. If people prefer I don't answer questions here, I'll move to PM)

Cledus James 02-09-2009 04:13 PM

Sent you a PM. :)

Cledus James 02-14-2009 04:57 AM

Ok, can someone help me just a bit more. Probably just an easy fix.

Now I added the last code posted to my plugin and it worked. It displayed the data from my custom profile field 18. In my above thread I said it was userfield24 but I had it wrong, it's userfield18. Now here's my plugin code:


Code:

$blocklist = array_merge($blocklist, array(
        'mymodification' => array(
                'class' => 'MyModification',
                'title' => 'My Modification',
                'hook_location' => 'profile_left_last'
        )
));

class vB_ProfileBlock_MyModification extends vB_ProfileBlock
{
        var $template_name = 'memberinfo_block_mymodification';

        function confirm_empty_wrap()
        {
                return false;
        }

        function confirm_display()
        {
                return ($this->block_data['mymodification'] != '');
        }

        function prepare_output($id = '', $options = array())
    {
 
        $this->block_data['mymodification'] = $this->profile->userinfo['field18'] ? "Stuff: ".$this->profile->userinfo['field18'] : "Nothing to see here";
    }
}

Like I said works fine with one small problem. Now the data I have stored in userfield18 is a list of information, like:

1. List Item 1
2. List Item 2
3. List Item 3
4. List Item 4
etc.

Now when its displayed in the new tab it all comes out on the same line like:

1. List Item 1 2. List Item 2 3. List Item 3 4. List Item 4

My question is, is there any way I can get it to be displayed in a list format? Like creating a new line for every list object? I tried adding a BR command in the field input itself without any luck. Anyone know how I can get it displayed like the way I input it into the field?

Thank you for any help anyone may offer.

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

Can anyone help?

Lynne 02-14-2009 04:21 PM

I'm not sure, but I would take a look at exactly what is in that field and see what separates the items and perhaps do a search/replace on the separator with a <br />

Cledus James 02-15-2009 01:10 AM

Quote:

Originally Posted by Lynne (Post 1743990)
I'm not sure, but I would take a look at exactly what is in that field and see what separates the items and perhaps do a search/replace on the separator with a <br />

Basically its just a list of info that is manually entered by admins into a custom field via admin cp. We have a ranking system of 1-22 on the website. The list just basically lets the users know how that got to what rank and what they've gotten credit for towards rank.

Anyway here's the url of my site profiles:

My Profile - Now what I'm trying to do is display that information in the Rank Information module on the right side under the Mini Stats into a new profile tab. I made the plugin active again so you can see the output under the My Modification tab. Basically want the rank info from the module inside the new tab in a list format. I'll rename the new tab and remove the info from th emodule when I get it working properly.

If for some reason you can not see the info I'm talking about on my site here's an example of some information (as listed in the custom field in the admin cp) thats in my custom field that I want displayed in list format.

Quote:

1. Website Owner
2. 6 month Member
3. 1 year Member
4. 100 Website Posts
5. 250 Website Posts
6. 500 Website Posts
7. 1000 Website Posts
8. Website staff
9. Clan Recruiting
10. Gears of War Roster
11. Rainbow Six Vegas Roster
12. Battlefield: Bad Company Roster
13. Call of Duty 4 Roster
14. Ghost Recon 2 Roster
15. Grand Theft Auto 4 Roster
16. Rainbow Six Vegas 2 Roster
17. Rock Band 2 Roster
18. Gears of War 2 Roster
19. Call of Duty 5 Roster
20. 3 Month Member
21. 50 Website Posts
22. 750 Website Posts
Again it comes out as:

Quote:

Stuff: 1. Website Owner 2. 6 month Member 3. 1 year Member 4. 100 Website Posts 5. 250 Website Posts 6. 500 Website Posts 7. 1000 Website Posts 8. Website staff 9. Clan Recruiting 10. Gears of War Roster 11. Rainbow Six Vegas Roster 12. Battlefield: Bad Company Roster 13. Call of Duty 4 Roster 14. Ghost Recon 2 Roster 15. Grand Theft Auto 4 Roster 16. Rainbow Six Vegas 2 Roster 17. Rock Band 2 Roster 18. Gears of War 2 Roster 19. Call of Duty 5 Roster 20. 3 Month Member 21. 50 Website Posts 22. 750 Website Posts
in the new profile tab.


Hope this helps you help me, lol. Thanks for your time.


All times are GMT. The time now is 10:55 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.01970 seconds
  • Memory Usage 1,917KB
  • 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
  • (19)bbcode_code_printable
  • (5)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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