Modifying Author Panel in viewtopic

Support for IntegraMOD 140

Moderator: Integra Moderator

Modifying Author Panel in viewtopic

PostAuthor: Kate » Thu Aug 03, 2006 3:44 am

I am looking to add a little XBOX LIVE mod (that I know someone else asked about here) to my forums. I need to do the following:

1. Add a required field in the user profile (gamertag)
2. Set a variable to assign a URL to the gamertag that shows up in the viewtopic.php AND big profile.
3. How do I do this with PCP?

I can do this with regular phpBB no problem, but I've not dealt with this panel before and I wanted to ask if there was any documentation on this before I started getting my hands dirty.

Thanks in advance!
Kate
Last edited by Kate on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
Kate
Newbie
Newbie
 
Posts: 25
Likes: 0 post
Liked in: 0 post
Joined: Tue May 02, 2006 3:58 am
Cash on hand: 0.00
Location: Philadelphia

Re: Modifying Author Panel in viewtopic

PostAuthor: Teelk » Thu Aug 03, 2006 6:54 am

Usually what I do to port MODs to PCP is take any viewtopic or usercp_viewprofile code that exists in the install instructions and write functions that I place in profilcp/def/def_userfuncs_custom.php.

Then I add the code to the def_userfields.php and def_usermaps.php. Almost every field in def_userfields.php from a MOD like the one you describe will go under generic informations.

I'm terrible at describing this sort of thing, so please bare with me.

I'll use the field for the Full Album Pack, since I have it right here...
Code: Select all
            'user_album' => array(                 'lang_key'     => 'Gallery',                 'class'        => 'generic',                 'type'         => 'VARCHAR',                 'dsp_func'     => 'pcp_output_album',             ),

The field user_album is calling the display function pcp_output_album, which is the function you would place in profilcp/def/def_userfuncs_custom.php. The lang_key can be a lang key or if there's no lang_key whatever you've put there will be displayed, if text is displayed for this particular field. Type, that's obvious, whatever the db info is your calling.

On to def_usermaps.php
Here it's key to find the right location. Use the parent and child array names as hints to what they might be. Then place your code where you want it.
Code: Select all
                        'user_album' => array(                                 'img'          => true,                                 'style'        => '<td><span>%s </span></td>',                             ),
img being true means there'll be an image involved and that you've defined $img in your function, same with $txt and 'txt' => true. Style's pretty obvious, just keep the %s, as that's your output.

I hope I've helped somehow... there's so much more to this that I can't articulate...
Last edited by Teelk on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
Teelk
Dev Team
Dev Team
 
Posts: 1309
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 14, 2006 6:25 pm
Cash on hand: 0.00
Location: Canada

PostAuthor: Kate » Sun Aug 06, 2006 9:15 am

Thanks Teelk.

So I've put the following in def_userfields:
Code: Select all
 under  // generic informations  //XBOXLIVE Mod             'gamertag' => array(                 'lang_key'       => 'Gamertag',                 'class'           => 'generic',                 'type'           => 'VARCHAR',                 'visibility'     => true,                 'required'       => true,                         ),



And the following in def_usermaps]     under 'PCP.profil.profile_prefer.Registering_info'  //XBOX LIVE Mod                         'gamertag'     => array(                             ),      under 'PHPBB.viewtopic.left'  //XBOX LIVE Mod                         'gamertag' => array(                                 'leg'             => true,                                 'txt'             => true,                                 'style'           => '<div>%s</div>',                             ),[/code]

Now I'm getting

Sorry, it appears this is your first visit since we added some required fields to the system.
Once you update the fields marked with *, you will be able to enjoy the whole site.
Thanks!

Click on the fieldnames below to complete them:
The Field "" is required


Where do I need to call these variables for the fields to show up? Where in the template do I need to add the input field, etc? Do I need to add "gamertag" as a field into my SQL database?

Last question (for now) - what is 'leg' ? <img>
Last edited by Kate on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
Kate
Newbie
Newbie
 
Posts: 25
Likes: 0 post
Liked in: 0 post
Joined: Tue May 02, 2006 3:58 am
Cash on hand: 0.00
Location: Philadelphia

Re: Modifying Author Panel in viewtopic

PostAuthor: Teelk » Sun Aug 06, 2006 1:03 pm

I'm not home right now, so I don't have access to files for example.

But, you'll need to create a field in the users table called user_gametag and an output function in def_userfuncs_custom.php. Take a look at some of the other functions in the def_userfuncs_xxxx.php files for examples. When I get home I'll write up an example function for you.

You're also getting that message because you've made the field required but can't input it anywhere. I'd remove the required for the time being so you can play with it.
Last edited by Teelk on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
Teelk
Dev Team
Dev Team
 
Posts: 1309
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 14, 2006 6:25 pm
Cash on hand: 0.00
Location: Canada

PostAuthor: Kate » Fri Aug 11, 2006 3:36 am

Okay I have it working. Holy crap <img>

Question:

I want the profile to have the "Gamertag" field name, but in the viewtopic.left I don't want it to show up. If I remove 'txt' => 'Gamertag' from def_userfields.php it takes it away from both.

Ideas?
Last edited by Kate on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
Kate
Newbie
Newbie
 
Posts: 25
Likes: 0 post
Liked in: 0 post
Joined: Tue May 02, 2006 3:58 am
Cash on hand: 0.00
Location: Philadelphia

PostAuthor: Kate » Fri Aug 11, 2006 3:37 am

WOOT!! I figured it out <img> wow this is exciting! Thanks Teelk!
Last edited by Kate on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
Kate
Newbie
Newbie
 
Posts: 25
Likes: 0 post
Liked in: 0 post
Joined: Tue May 02, 2006 3:58 am
Cash on hand: 0.00
Location: Philadelphia

Re: Modifying Author Panel in viewtopic

PostAuthor: Teelk » Sun Aug 13, 2006 8:11 pm

Glad you got it working... sorry for the delay in getting an example function for you. But, you seem to have worked everything out without me. <img>
Last edited by Teelk on Wed Dec 31, 1969 5:00 pm, edited 1 time in total.
User avatar
Teelk
Dev Team
Dev Team
 
Posts: 1309
Likes: 0 post
Liked in: 0 post
Joined: Tue Mar 14, 2006 6:25 pm
Cash on hand: 0.00
Location: Canada


Return to IntegraMOD 140

Who is online

Registered users: App360MonitorBot, Bing [Bot]