MyBB Hacks

Full Version: Link ID To Custom Profile Fields/Custom Edit Pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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:

Would this be possible?


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:

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

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>

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.
I tried this and it didn't work:

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

<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:

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


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:

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

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

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

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:
(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.
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?
You also need to grab the PHP codes related to it.
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!
Mostly you'll find them inside the modcp.php file.
Pages: 1 2
Reference URL's