Link to members forum?

Need help with your forum? Ask away. Remember though that there's always http://www.phpbb.com/community

Moderator: Experts

Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Link to members forum?

Post by Graham »

Hi
My site is a poetry site where each member has their own forum to post their poems.
What I want is, under their avatar, to have a link that goes right to their forum.
So you would have under my avatar,
Graham, which takes you to my profile (this is obviously already there), and beneath that
Poems by Graham, which would take you directly to my forum.
Is it possible?

Thanks
Graham
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Link to members forum?

Post by DavidIQ »

It's possible. You'll need to create a custom profile field in which they could put their forum id. Then you would need to modify the template for viewtopic.html a bit to add the link. The url should be of the format "viewforum.php?f=2" where 2 is the id number of the forum. If you need further help let me know and I'll have to look at it a bit later but hopefully this is enough to give you an idea of what to do.

EDIT: Actually I'll probably need to take a look later either way...you may need to do some code modification.
Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Re: Link to members forum?

Post by Graham »

David,

I think I'll wait a bit till you've managed to have a look further in to the possibility of doing it.
There's no rush, I'm sure you're busy enough as it is.

Thanks

Graham
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Link to members forum?

Post by DavidIQ »

Got it going and without doing any physical code changes :-D
Here's what you do to get this working.

1st PART:

First you'll need to create a custom profile field: ACP -> Users and Groups -> Custom profile fields. Create a new one and call it "My Poems" and select "Numbers" from the drop-down. Make field identification "my_poems_forum", Display Profile Field - Yes, Display in user control panel - selected, Description that I put: "Enter the forum ID/Number where your poems are stored at." but you can make that anything you want. Once you finish that you have a custom profile field for all the users to enter the forum ID for their poems in their profile.

2nd PART:

This is a bit more tricky but I'll make it as easy as possible. Go to the Styles tab then click on templates and edit for your style. Select viewtopic_body.html and find this part (assuming you're using a prosilver-based style):

Code: Select all

			<dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}:</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd>
Replace with:

Code: Select all

		<!-- IF postrow.custom_fields.PROFILE_FIELD_NAME == 'My Poems' -->
			<dd><strong><a href="./viewforum.php?f={postrow.custom_fields.PROFILE_FIELD_VALUE}">{postrow.POST_AUTHOR}'s Poems</a></strong></dd>
		<!-- ELSE -->
			<dd><strong>{postrow.custom_fields.PROFILE_FIELD_NAME}:</strong> {postrow.custom_fields.PROFILE_FIELD_VALUE}</dd>
		<!-- ENDIF -->
That should be it. You'll need to explain to your users how to get their forum's id by looking at the URL for their forum and getting the number after f=
Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Re: Link to members forum?

Post by Graham »

Morning David,

I've got the custom field to show in the user profile, and I've entered a forum number, but it does not show underneath the user name on the forum when viewing a topic posted by the user.
I'm testing it out on a desktop server XAMPP, not sure if that's anything to do with it or not?


Thanks
Graham
Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Re: Link to members forum?

Post by Graham »

David,
Just for information, tried it now on my live board still no luck, which is dammed annoying as I see DavidIQ's Poems under your name!!

Graham
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Link to members forum?

Post by DavidIQ »

Did you do the style edit?
Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Re: Link to members forum?

Post by Graham »

Yep, did that bit. ;)
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Link to members forum?

Post by DavidIQ »

I re-registered. Please activate my account and add me to the admin group so I can take a look at what's up.
Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Re: Link to members forum?

Post by Graham »

OK David you're account is active and you have Admin rank.

Thanks
Graham
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Link to members forum?

Post by DavidIQ »

I have admin rank but not admin permissions which is what I need ;-)
Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Re: Link to members forum?

Post by Graham »

OK David,

Sorry about that, all should be right now.

Graham
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Link to members forum?

Post by DavidIQ »

You had it all right :-)
I didn't mention that there was a setting you needed to enable. I assumed it was enabled by default but it was disabled by default instead. The feature was in "Load Settings" and it's called "Display custom profile fields on topic pages". I enabled it and now the field shows. Also took care of the user profile. Edited memberlist_view.html and replaced this:

Code: Select all

		<!-- BEGIN custom_fields --><dt>{custom_fields.PROFILE_FIELD_NAME}:</dt> <dd>{custom_fields.PROFILE_FIELD_VALUE}</dd><!-- END custom_fields -->
with this:

Code: Select all

		<!-- BEGIN custom_fields --><!-- IF custom_fields.PROFILE_FIELD_NAME == 'My Poems' --><dt>&nbsp;</dt><dd><a href="./viewforum.php?f={custom_fields.PROFILE_FIELD_VALUE}">Poems by {USERNAME}</a></dd><!-- ELSE --><dt>{custom_fields.PROFILE_FIELD_NAME}:</dt> <dd>{custom_fields.PROFILE_FIELD_VALUE}</dd><!-- ENDIF --><!-- END custom_fields -->
Graham
Posts: 76
Joined: Mon Oct 20, 2008 3:31 am
Location: UK
Contact:

Re: Link to members forum?

Post by Graham »

David,
Thank you for all your help, I asked this same question at phpBB, here is the only reply I recieved.
I don't know any easy way to do what you are asking. You can add a link to the profile pretty easily, but how to assign a specific forum to that user? Would take a lot of configuring based on how many members you have.
The members could just put it in their signature as an alternative.
Can I now reply to that telling people if they want the answer to visit here.
I think you should make it a Mod so that users could use it for 'My Favourite Forum'.

Thanks again
Graham

PS
I'll leave you as a member this time.
DavidIQ
Site Admin
Posts: 619
Joined: Thu Sep 07, 2006 4:31 pm
Location: Earth
Contact:

Re: Link to members forum?

Post by DavidIQ »

Linked that topic back to here ;-)

Thanks.
Post Reply