Link ID To Custom Profile Fields/Custom Edit Pages
Niki Offline
Junior Member
**
Posts: 29
Joined: Oct 2016
Post: #1
Link ID To Custom Profile Fields/Custom Edit Pages
You seem like just the right people to ask.

I've been searching EVERYWHERE how to do this but alas I can't find anything to help me.

I'm trying to figure out how to add an ID number to a custom profile fields name in the usercp as well as the modcp so that eventually I can make links up at the top of those pages where people can click the link and it jumps down to that profile field so that can easily find it.

I'm thinking this will require some sort of core edit but for example I have added this to the top of my Mod CP in hopes that it would start something:

PHP Code:
<a href="#find_me_{$customfields['fid31']}">Bio</a>


However, I need to be able to add the find me as an ID on the custom fields but I don't see a template for it anywhere:

PHP Code:
id="find_me_{$customfields['fid']}"


Would this be possible?


ORRRRRR


Would it be possible to create my OWN custom edit profile/mod cp profile editor pages?

Like adding something along these lines in for specific custom fields:

PHP Code:
{$customfields['fid31']}

^ Doing the above gave me this error so apparently the above isn't possible but maybe I'm using the wrong variable:

Code:
The following warnings occurred:
Warning [2] Illegal string offset 'fid31' - Line: 16 - File: modcp.php(3202) : eval()'d code PHP 5.4.45 (Linux)
File	Line	Function
/modcp.php(3202) : eval()'d code	16	errorHandler->error
/modcp.php	3202	eval


<i><b>Special Note:</b> I do have Template Conditionals plugin installed, so if this can be done by utilizing that plugin, that'd be wonderful!</i>

02-02-2017 10:44 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #2
RE: Link ID To Custom Profile Fields/Custom Edit Pages
For custom profile fields, ModCP shares the same templates with UserCP.

You can try to add the ID inside your usercp_profile_customfield template by using {$profilefield['fid']} as the ID of each profile fields.

02-02-2017 10:17 PM
Find all posts by this user Quote this message in a reply
Niki Offline
Junior Member
**
Posts: 29
Joined: Oct 2016
Post: #3
RE: Link ID To Custom Profile Fields/Custom Edit Pages
I tried this and it didn't work:

Code:
<a href="#num_{$profilefield['fid13']}">Test</a>

Code:
<h2 id="num_{$profilefield['fid']}">{$profilefield['name']}</h2>


HOWEVER if I remove the 13 part from the initial test text that should jump to the number it goes to ID 57 for some odd reason. Otherwise it doesn't work:

Code:
<a href="#num_{$profilefield['fid']}">Test</a>

Code:
/modcp.php?action=editprofile&uid=4#num_57

02-03-2017 11:04 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #4
RE: Link ID To Custom Profile Fields/Custom Edit Pages
Fro the URL, you need to put the ID manually inside your URL (for this, you need to know the ID of the profile field).
For example, inside the modcp_editprofile template, and the ID of the Bio profile field is 2:

HTML Code
<a href="#num_2">Bio</a>


For the anchor, use {$profilefield['fid']} as I stated above.
For example:

HTML Code
<h2 id="num_{$profilefield['fid']}">{$profilefield['name']}</h2>


02-04-2017 01:47 AM
Find all posts by this user Quote this message in a reply
Niki Offline
Junior Member
**
Posts: 29
Joined: Oct 2016
Post: #5
RE: Link ID To Custom Profile Fields/Custom Edit Pages
Oh my goodness, how did I not think of that??

Thank you! I will test this out as soon as possible, another question regarding this similar topic would be, is it possible to customize the edit profile page/mod cp page?

As it add your own tables and put specific profile fields in specific places kind of like this: https://s28.postimg.org/uz3y395sd/Capture.png
02-09-2017 04:06 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #6
RE: Link ID To Custom Profile Fields/Custom Edit Pages
(02-09-2017 04:06 AM)Niki Wrote:  is it possible to customize the edit profile page/mod cp page?

I think the easiest way is using tabs (javascript) in the page.

02-09-2017 11:34 PM
Find all posts by this user Quote this message in a reply
Niki Offline
Junior Member
**
Posts: 29
Joined: Oct 2016
Post: #7
RE: Link ID To Custom Profile Fields/Custom Edit Pages
So I wouldn't be able to just plop down a variable inside a specific bit of coding to have that profile field pop up there/where ever I put it/call it forth?
02-10-2017 10:34 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #8
RE: Link ID To Custom Profile Fields/Custom Edit Pages
You also need to grab the PHP codes related to it.

02-14-2017 12:17 AM
Find all posts by this user Quote this message in a reply
Niki Offline
Junior Member
**
Posts: 29
Joined: Oct 2016
Post: #9
RE: Link ID To Custom Profile Fields/Custom Edit Pages
By chance do you know where I would find those codes? (Core file or are they in templates somewhere)

If I need to use the PHP code, would I have to install the PHP In Templates plugin?

Also, sorry for all the questions but thank you for answering them!
02-14-2017 06:39 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #10
RE: Link ID To Custom Profile Fields/Custom Edit Pages
Mostly you'll find them inside the modcp.php file.

02-15-2017 02:55 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: