Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: utroda - helmikuu 06, 2014, 07:20:11 IP

Otsikko: Additional Profile Pages
Kirjoitti: utroda - helmikuu 06, 2014, 07:20:11 IP
Hello,

I'm wondering if its possible to add a new page under the user profile. We have a required field when members join which is their in game user name, I would like to use this to create a stats page within the user profile. We are running SMF 2.0.7.

The player stats are gathered by a cron outside of the forum and stored into a different DB.  This new page would parse those stats and display them based on the username of the profile being viewed.

Would this be possible and how would I go about setting up a new page under the users profile?

Edit: I guess i should say i looked around but it was unclear to me how pages are handled within the profile area.

Thanks for the time, and any help  ;)
Otsikko: Re: Additional Profile Pages
Kirjoitti: codenaught - helmikuu 08, 2014, 04:52:05 IP
Probably the relevant code you would want to look at is in Sources/Profile.php.

$profile_areas = array(

Root elements in that array such as 'info' and 'edit_profile' are what make up the profile tabs. Items nested within those make up the separate sections/links of those tabs.

In general creating a new page would follow the same layout that the existing sections use. You could set it up with your custom file to point to with the 'file' property.

Example:

'customPage' => array(
'label' => 'My Custom Page',
'file' => 'MyCustomFile.php',
'function' => 'customFunc',
'sc' => 'post',
'permission' => array(
'own' => array('profile_extra_any', 'profile_extra_own'),
'any' => array('profile_extra_any'),
),
),


Although I am thinking there could be an existing mod to create custom profile pages that you might be able to use.