Previous Thread
Next Thread
Print Thread
Hop To
Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
Is there a way I can give users the ability to enable or disable topic preview in their edit profile page?

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
yah, with a small modification

1. add a custom field ( there are 5 available )
2. modify scripts/postlist.inc.php to check that field and show / not shop tooltip

smile

Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
This is a far as I've gotten:

Code
				<label for="CUSTOM_FIELD_1">Post Preview (0 = hide 1 = show)</label>
				<br />
				<input type="text" name="CUSTOM_FIELD_1" id="CUSTOM_FIELD_1" value="1" class="form-input" /><br /><br />

But it's not working correctly...

Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
I have gotten the option to appear in My Stuff/Edit Profile, but could you tell me how to modify the postlist.inc.php to refer to that custom function tooltip, so it actually works?

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
1. You don't need to modify a template at all.
2. Just go into Registration settings / Registration screen and set the Custom field prompt ( example picture below )

[Linked Image from sirdude.com]

I set it to hide and that really just HIDES it only @ registration, but because I fill it in, then it will always now show when they edit their PROFILE.

Then the only modification to do is in scripts/postlist.inc.php

On line 43 ( approx ), add the extra field to the list of fields to retrieve for each user:

"user_fields" => "t2.USER_TOPIC_VIEW_TYPE, t2.USER_TOPICS_PER_PAGE, t2.USER_POSTS_PER_TOPIC,USER_EXTRA_FIELD_1",

Then around line 837 you will see:
PHP Code

// Gotta clean out the [ and ], as they are keys to the .js parser. Also need to fix graemlin links
$postrow[$z]['tooltip'] = "";
if ($config['TOOLTIP_LENGTH'] && $config['TOOLTIP_LENGTH'] > 0) { 

change that to this:
PHP Code

// Gotta clean out the [ and ], as they are keys to the .js parser. Also need to fix graemlin links
$postrow[$z]['tooltip'] = "";
if ($config['TOOLTIP_LENGTH'] && $config['TOOLTIP_LENGTH'] > 0 && $user['USER_EXTRA_FIELD_1'] == '1') { 

this will allow the user to edit their profile and put 1 to enable the tooltip or 0 to not have it.

Then you make the board to always show it by default, but allow users to turn it off in their profile

2c

Joined: Jun 2010
Posts: 58
R
journeyman
journeyman
R Offline
Joined: Jun 2010
Posts: 58
You're tha man. Thank you very much!!! Or as we say here locally, "Salamat Po"

Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
No problemo

I posted a more detailed explanation over on my blog Clicky Poo for anyone interested

2c


Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
spam issues
by ECNet - 03/19/2024 11:45 PM
Who's Online Now
1 members (1 invisible), 875 guests, and 141 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)