[How To] Utilizing each Custom Profile Field

How-to's, little tricks, tutorials, code examples (snippets) and read-me's.

Re: [How To] Utilizing each Custom Profile Field

Postby King Rhyono » 23 Jan 2011, 22:29

I don't really feel like getting into #1 right now. For the second question: Probably the easiest way I can think of is to make the field identification something like "Signature_X," the "X" being the forum number. Then make a template var and name it something like "postrow.new_signature" (this is the var that would go in place of whatever is currently used to load the signature) Then specify in a relevant php file (functions.php is always a good one) that the "new_signature" variable is the value of the custom profile field of "Signature_" and the forum_id. The idea works in theory but would require actually starting on before being sure of it.

After looking at that, it's the easiest way for me. You may want to do the naming convention for signature custom profile fields I initially mentioned and instead introduce forum_id into functions.php (it might already, I never really looked) and then just do something like "<!-- IF FORUM_ID == 1 -->{signature_1}<!-- ELSE IF FORUM_ID == 2 -->{signature_2}<!-- ENDIF -->"
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male


Re: [How To] Utilizing each Custom Profile Field

Postby Sniper_E » 24 Jan 2011, 00:12

Cool Rhyono, then I'll touch on #1
One nice way to shorten the Characters listings in your UCP would be to use the show/hide script in your template.
You could click on a 'Set Characters' link and that long list of character options would open up for you.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
User avatar
Sniper_E    
STG Jedi Master
STG Jedi Master
 
Posts: 6980
Joined: 31 May 2006, 06:29
Location: Shreveport, LA
Favorite Team: The STG Team
Gender: Male
phpBB Knowledge: 6

Re: [How To] Utilizing each Custom Profile Field

Postby Honor » 24 Jan 2011, 12:36

Ooo I love that, Sniper! I will play with that tonight, see if I can't figure it out on my own :D

Rhyono, I understand the gist of what you want me to do, but it's just a tiny bit out of my comfort range. I like the Forum ID idea, and would use that in a heartbeat. My fear is syntax, which, honestly, I suck at :P

Can you get me a step by step for one or two sigs? Or an example I can play off of? Also, how would I account for images and bbcodes like the normal sig editor? (I may just edit that template, actually, and make the separate fields there by duplicating it with different ids, if that's how it works)
BluePlanet RP
my own creation.

Host: Host Monster
Version: 3.0.9
Honor    
STG Moderator
STG Moderator
 
Posts: 328
Joined: 23 Dec 2010, 10:53
Gender: Female
phpBB Knowledge: 2

Re: [How To] Utilizing each Custom Profile Field

Postby Honor » 24 Jan 2011, 13:00

Oh sheesh, I just looked at the sig editor file.... yea not happening :P not without help anyway.

Also, Rhyono, I just realized that I would need multiple forum IDs in there, since one forum has many subforums in it. I'm really not sure the best way to go.
BluePlanet RP
my own creation.

Host: Host Monster
Version: 3.0.9
Honor    
STG Moderator
STG Moderator
 
Posts: 328
Joined: 23 Dec 2010, 10:53
Gender: Female
phpBB Knowledge: 2

Re: [How To] Utilizing each Custom Profile Field

Postby King Rhyono » 24 Jan 2011, 16:10

<!-- IF FORUM_ID == 1 || FORUM_ID == 5 || FORUM_ID == 308-->

Is how you'd do multiple.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: [How To] Utilizing each Custom Profile Field

Postby Honor » 25 Jan 2011, 08:23

Previous question - how would allowing images/bbcodes/links etc work with this? For the signature I mean.
BluePlanet RP
my own creation.

Host: Host Monster
Version: 3.0.9
Honor    
STG Moderator
STG Moderator
 
Posts: 328
Joined: 23 Dec 2010, 10:53
Gender: Female
phpBB Knowledge: 2

Re: [How To] Utilizing each Custom Profile Field

Postby King Rhyono » 25 Jan 2011, 11:04

Honor wrote:Previous question - how would allowing images/bbcodes/links etc work with this? For the signature I mean.


The BBcode handling will have to be looked into. Once I have some more free time later today I'll take a look at it. First glance looks like it could be annoying. At this point we are straying from the purpose of this thread though.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: [How To] Utilizing each Custom Profile Field

Postby Honor » 02 Feb 2011, 10:10

*very soft gentle nudge bump of the friendliest kind...*

I don't think this is completely off topic as we are still working with custom profile fields. I have been conversing with a coworker of mine who has some inspiration but no time to execute. The following is our email convo - I hope it helps you guys help me :P

((PS, this fix would push my board into a category of it's own for my genre :D ))

BTW, this guy is a PHP whiz - he made his own blog interface and writes all his own code.

Honor wrote:Hey, there's something I'm trying to accomplish with my forum that I didn't know if you could help me with. What I want to do is find a way for users to be able to specify a sig depending on the forum. So if their post is in a political forum, it would show a political sig, and if it was in a movie forum, it would show a movie sig, etc. I've got a very basic idea of using <!-- IF Forum # --> off of another website, but I neither know how to allow images or bbcodes into the box, nor do I know the exact syntax.

As far as I know, I can do this two ways - one is through the ACP with custom profile fields (would show in a separate place other than the sig section in UCP). The other, and one I definitely do not know how to do, is to change the sig coding itself so it's not only all in one place, but perhaps cleaner?

Again, this is only if you have the time. :) It would come in really handy for me tho, and I'd like to learn the code/database commands that run with something like this.


Coworker wrote:well the commented if conditional is mainly a browser hack used for IE compatibility, so that's probably not the best approach (unreliable). Changing or expanding the sig generation code is also something I'd stay away from, as you'd potentially break your site every time you went to update it.

Custom Profile Fields would be interesting, and you could probably replace the signature output code in the template with one that did what you want to do. The things you want to stay away from are making changes to distributable code, and editing database tables. Have you looked in to if there are any plugins that offer this feature?


Honor wrote:The custom profile fields is the best, in my opinion. I can create them in the ACP. They would just show up under Profile instead of Sig in the UCP. I even know how to place them in the sig area for posts.

If I do it this way, then the only two things I really need help with is this: The custom profile fields are text only. They do not operate (parse? a word I really need to look up lol) HTML or BBCodes at all, and i would need images at the very least to show (through an external uploader would make me happy, if not doable through the site itself). The other thing is making it so that the board only shows the right sig for the right forum - I would in essence have I think ten custom profile fields, one for each section of my site, and then that one sig would show in that one section only.

There are no plugins that I could find besides a guide on how to tweak the custom profile fields. I did manage to get help on making the text link friendly, but that required two fields for one link (text, then link), then the template had a moderate sized addition for just one link.


Coworker wrote:well, I don't know enough about phpBB templating anymore to give you any definitive answers. My sense is that, if it comes right down to it, you can use str_replace() function to force the text to display images, bbcode, whatever. Might get a lil complicated, but I'm sure it can be done. You can get a WYSIWYG editor with image uploading (TinyMCE is what I usually use), and there are ways to add the interface to a textbox (rather or not you break upgradability in the process is a different matter).

Once you have your method figured out, the replacing of the signature should be pretty straight forward. Just find the spot in the template where it drops, comment it out, and add a lil logic that points it to the proper custom field based on the forum your currently viewing. Maybe write a lil function that rebulds the broken HTML saved to the field, and pass everything thru it before you output.


If someone could.... translate, and help me with this, I'd be forever grateful!
BluePlanet RP
my own creation.

Host: Host Monster
Version: 3.0.9
Honor    
STG Moderator
STG Moderator
 
Posts: 328
Joined: 23 Dec 2010, 10:53
Gender: Female
phpBB Knowledge: 2

Re: [How To] Utilizing each Custom Profile Field

Postby King Rhyono » 03 Feb 2011, 07:48

I forgot to get back to you on my findings and I've been busy. A CPF will not work, at least not directly. BBcode has to go through the signature page because it parses the BBcode by adding an id specific to your user (I believe it changes frequently or per each posting instance) to the BBcode tag. For example: [b] becomes [b:2wq0334]. Also, only very specific areas parse BBcode, so just loading it into the signature area won't work at all.
King Rhyono
MOD Author
MOD Author
 
Posts: 174
Joined: 01 Aug 2007, 11:20
Gender: Male

Re: [How To] Utilizing each Custom Profile Field

Postby Honor » 18 Mar 2011, 17:04

Hey Sniper - I'm trying to figure out how to use the show/hide script in my UCP to hide some fields away, but I can't figure out how. Can you get me started?
BluePlanet RP
my own creation.

Host: Host Monster
Version: 3.0.9
Honor    
STG Moderator
STG Moderator
 
Posts: 328
Joined: 23 Dec 2010, 10:53
Gender: Female
phpBB Knowledge: 2

PreviousNext

Return to Tutorials and How-Tos

Who is online

Users browsing this forum: No registered users and 4 guests