Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Any way for users to hide signatures?
Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2017 - 4:18 pm

The current user of the system can be accessed using the $spThisUser data object, Also available in the data inspector.

andy-signature.png
YELLOW
SWORDFISH
Avatar
mike olson
Member
sp_UserOfflineSmall Offline
Mar 14, 2017 - 4:20 pm

Ok but I need to know how to get at the data to make an conditional statement. 

 

How do I get the value of $spThisUser's custom profile field named hidesignatures to evaluate it's value? 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2017 - 4:27 pm

Exactly as I described in post #7 previously:

$spThisUser->hidesignatures

andy-signature.png
YELLOW
SWORDFISH
Avatar
mike olson
Member
sp_UserOfflineSmall Offline
Mar 14, 2017 - 4:48 pm

Yellow Swordfish said
Exactly as I described in post #7 previously:

$spThisUser->hidesignatures

  

Damn I apologize I didn't see that. 

 

Ok so this si what I did in case anyone else wants to do it. 

Create a custom profile checkbox field called Hide Signatures 

 

Then in 

/desktop/spTopicViewDesktop.php (do similarly in the mobile template as well)

 

Replace this:

sp_PostIndexUserFlexSignature('tagClass=spPostUserSignature');

 

with this:

if($spThisUser->hidesignatures==''){sp_PostIndexUserFlexSignature('tagClass=spPostUserSignature');}

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 14, 2017 - 6:29 pm

There you go,. Good one.

andy-signature.png
YELLOW
SWORDFISH
Avatar
mike olson
Member
sp_UserOfflineSmall Offline
Mar 15, 2017 - 1:21 am

Unfortunately it only sort of worked. It caused an error on threads with many replies. Once it calculated that it was going to need to go to another page it created a link to the next page but then the signatures being hidden made that page unnecessary so if you clicked the link to go to the next page it threw a database connection error. 

 

I need to figure out how to keep that from happening. 

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 15, 2017 - 4:15 am

I don't see any way that the change can possibly cause that sort of problem. That makes no logical sense at all. While I am not that fond of the way you have written it, the code is valid. (Personally we would have written it - assuming your new field is a checkbox so true/false):

if (! $spThisUser->hidesignatures) sp_PostIndexUserFlexSignature(‘tagClass=spPostUserSignature’);

Take a look in the error log (toolbox). Clear the error log out, run the page, replicate the problem and then take another look. Anything relevant?

andy-signature.png
YELLOW
SWORDFISH
Avatar
mike olson
Member
sp_UserOfflineSmall Offline
Mar 15, 2017 - 3:12 pm

I will give this a go tonight and post the error logs

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 15, 2017 - 8:03 pm

please do.. especially the db error...

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 649
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 618
Members: 17357
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10123
Posts: 79616