Copying UCP profile tab

Discussion forum for MOD Writers regarding MOD Development.
Locked
cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Copying UCP profile tab

Post by cedricthecat » Mon Jan 12, 2015 7:15 pm

Hi folks

We've got a shed load of CPF's and as such, I'm looking to separate these into category pages (we're a car forum, and users can enter details for up to four cars, with six details for each). I'm hoping to work on the information contained in this post to achieve this

However, to begin with, I'm aiming at keeping it simple by copying the html from prosilver/template/ucp_profile_profile_info.html and just remove the code pertaining to the standard (non CPF) fields

So, I've got a copy of this pasted into a new html file and accessed via a new module link on the user's UCP profile page, but have been stopped in my tracks because this page will only display the non CPF fields, before I've even edited it!

Can anyone advise on what may be causing this?

Thanks!

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Copying UCP profile tab

Post by Brf » Mon Jan 12, 2015 7:30 pm

What are you using as your PHP code to invoke your new template?

cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Re: Copying UCP profile tab

Post by cedricthecat » Mon Jan 12, 2015 10:09 pm

I got my code from the second post in this topic

viewtopic.php?f=71&t=1757125

So I'm using

includes/ucp/info/ucp_main.php

Code: Select all

'car12_tab'   => array('title' => 'Edit first/second Car Details', 'auth' => '', 'cat' => array('UCP_MAIN')),
and

includes/ucp/ucp_main.php

Code: Select all

break;
					case 'car12_tab':

         $user->add_lang('mods/car12_tab');
in place of the examples given.

I'm thinking this isn't going to be right?!

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Copying UCP profile tab

Post by Brf » Mon Jan 12, 2015 10:21 pm

All that is doing is allowing your page to exist. You have a new lot for your house, but you did not build the house yet.

cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Re: Copying UCP profile tab

Post by cedricthecat » Mon Jan 12, 2015 10:25 pm

OK.......

Can you suggest where I could have a sneaky look at the plans? :D

(happy to do the building work myself, but if someone could pass me some wood and nails it'd be appreciated!)

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51870
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Copying UCP profile tab

Post by Brf » Mon Jan 12, 2015 10:30 pm

The guts of the profile are in includes/ucp/ucp_profile.php.
If you want to make your own profile page, you should start with that.

cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Re: Copying UCP profile tab

Post by cedricthecat » Mon Jan 12, 2015 10:35 pm

Okidoke, many thanks

I had a feeling that's where I should be looking, but nice to know for sure. Hopefully if I can get my head round this I'll be able to use the new page and then work on the editing :)

cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Re: Copying UCP profile tab

Post by cedricthecat » Wed Jan 14, 2015 10:32 pm

Thanks once again for pointing me in the right direction with this!

I was, of course, getting myself into knots by slavishly making edits copied from the linked thread, to the ucp_main.php files when I should have been looking at the ucp_profile.php files as you suggested!

Anyway, I did manage to create the modules and associated html files, and have got them working. However, I have found that, sadly, the principle of having separate modules for "batches" of CPF's (one per car) is flawed. Say you have 20 CPF's numbered 1 to 20, and set up four modules (one each for 1 to 5, 6 to 10 etc). Assuming you have data in all of these CPF's, and then change something in the first module, whilst it will successfully save these changes on submission, unfortunately it also sets all the other fields back to their default state!

Unless there's some way of avoiding this behaviour, I think the best that I can do is to set up a customised version of the standard profile page, with all of the CPF's and native fields available, but with the html grouping them into separate panels.....

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: Copying UCP profile tab

Post by Volksdevil » Wed Jan 14, 2015 11:13 pm

I've struggled with this for a long time too as you know Dave :cry: I did get it sort of working on my 3.0 forum viewtopic.php?f=71&t=2220591#p13564406 But it was a hell of a lot of messing, including having to request help in different topics to then hide profile fields being duplicated etc etc, it got really messy :cry:

In fact I think it's about time I looked into this again, but I'm now on 3.1 so hopefully no messing required!
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Re: Copying UCP profile tab

Post by cedricthecat » Wed Jan 14, 2015 11:23 pm

Hi Neil

So are you saying that you created individual modules, put all the CPF's (and standard profile fields) on them, but only displayed the ones you wanted each module to allow editing on, thus each time a submission was made, it did the lot?

(Using the example of 20 CPF's spilt over four modules, 1-5, 6-10, 11-15 and 16-20, this would mean the first one displayed 1-5 for editing, whilst also carrying, hidden, 6-20 etc?)

If this worked, then how did you hide the unneeded CPF's whilst still having them active in the module?!

cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Re: Copying UCP profile tab

Post by cedricthecat » Wed Jan 14, 2015 11:32 pm

Thinking about it, did you use something like popping all the CPF's you wanted in one visible panel, and all the rest in another, defining it something like

Code: Select all

<div ID="notshown" style="display:none">
This might work....?

Luckily I'd not released the new modules for general use, and was still testing them myself when I spotted the data being erased, so it's only my own profile that suffered a wiping! :mrgreen:

User avatar
Volksdevil
Registered User
Posts: 2414
Joined: Sun Oct 03, 2010 2:03 pm
Location: Lancashire, UK
Name: Neil
Contact:

Re: Copying UCP profile tab

Post by Volksdevil » Wed Jan 14, 2015 11:37 pm

cedricthecat wrote:Hi Neil

So are you saying that you created individual modules, put all the CPF's (and standard profile fields) on them, but only displayed the ones you wanted each module to allow editing on, thus each time a submission was made, it did the lot?
Yep, that's how it worked if I remember rightly Dave. I did only have the one extra UCP tab, with chosen profile fields displayed. Those fields were hidden on the main UCP profile page so nobody ever saw that they were being submitted. That's about all I remember I'm afraid, just had a quick read through my old posts and even I can't understand them :oops: :lol: The link in my last post was where I got most help to get it going and working.
My phpBB Extensions
Finally found great Website Hosting from Image KUALO!
Do NOT use 123-reg.co.uk - Incapable of running phpBB!
:ugeek: TekNeil - Streamer on Mixer | My Volkswagen Corrado G60

cedricthecat
Registered User
Posts: 212
Joined: Sun May 03, 2009 4:02 pm
Name: Dave

Re: Copying UCP profile tab

Post by cedricthecat » Wed Jan 14, 2015 11:45 pm

Cheers Neil!

I'll give the hiding fields thing a go and see how it pans out. I'll be chuffed if it works, although I doubt anyone will actually notice! ;)

Locked

Return to “[3.0.x] MOD Writers Discussion”