Syntax Error on Member List

Started by WolfJ, August 20, 2021, 08:38:51 AM

Previous topic - Next topic

WolfJ

I've got this error on the member list and I'm not sure what's caused. I've tried to uninstall the last couple of mods but still nothing. Any advice would be great thanks.

syntax error, unexpected '$context' (T_VARIABLE), expecting '('

Chewing on Cyanide


shadav

what mods have you installed that edited the memberlist files?

vbgamer45

Also attach your sources/memberlist.php
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

WolfJ

Quote from: shadav on August 20, 2021, 09:22:26 AMwhat mods have you installed that edited the memberlist files?

That's the issue, I don't remember what package I installed. Trying to look though all 41 now.

Quote from: vbgamer45 on August 20, 2021, 09:25:21 AMAlso attach your sources/memberlist.php

I've attached it below to this message.

You cannot view this attachment.



Thanks for the help

Chewing on Cyanide


Shambles

There's nothing wrong with the file you attached (according to https://www.piliapp.com/php-syntax-check/)

Are there any further pointers in your error log that may help pinpoint the file & line number thats generating the error?

WolfJ

Quote from: Shambles on August 20, 2021, 04:20:05 PMThere's nothing wrong with the file you attached (according to https://www.piliapp.com/php-syntax-check/)

Are there any further pointers in your error log that may help pinpoint the file & line number thats generating the error?

Just gives me that one critical error in the logs. Nothing else about the member list.

Chewing on Cyanide


vbgamer45

And it doesn't say the file or line number? in the error log???
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

WolfJ

This is all I see on the error log. Nothing else. I wish I knew what was causing this.

You cannot view this attachment.

Chewing on Cyanide


shadav

the only thing in your source file that I see is the posts array commented out
not sure why though but um ok
/* 'posts' => array(
'label' => $txt['posts'],
'width' => '115',
'colspan' => '2',
'default_sort_rev' => true,
)*/

can you upload your Memberlist.template.php

shadav

ok so I can't edit my post...
i think i see the problem ;)
since you commited out the posts array you need to change the array above it from ), to )
so right above what I posted above find that then directly above it
'registered' => array(
'label' => $txt['date_registered']
),
change to
'registered' => array(
'label' => $txt['date_registered']
)

WolfJ

Quote from: shadav on August 21, 2021, 03:36:03 PMthe only thing in your source file that I see is the posts array commented out
not sure why though but um ok
/* 'posts' => array(
'label' => $txt['posts'],
'width' => '115',
'colspan' => '2',
'default_sort_rev' => true,
)*/

can you upload your Memberlist.template.php

I have no idea what mod did this or why it's like if I'm honest but I can upload that file

You cannot view this attachment.

Quote from: shadav on August 21, 2021, 03:39:43 PMok so I can't edit my post...
i think i see the problem ;)
since you commited out the posts array you need to change the array above it from ), to )
so right above what I posted above find that then directly above it
'registered' => array(
'label' => $txt['date_registered']
),
change to
'registered' => array(
'label' => $txt['date_registered']
)

I tried this fix but sadly it's still not working. Thanks for trying though!

Chewing on Cyanide


GL700Wing

I think I've found the problem on line 118 of your Memberlist.template.php

Find:
if $context['user']['is_admin'] && (!empty($member['post_percent']))
Replace With:
if ($context['user']['is_admin'] && !empty($member['post_percent']))
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

WolfJ

Quote from: GL700Wing on August 23, 2021, 08:27:49 AMI think I've found the problem on line 118 of your Memberlist.template.php

Find:
if $context['user']['is_admin'] && (!empty($member['post_percent']))
Replace With:
if ($context['user']['is_admin'] && !empty($member['post_percent']))

Thanks for your response. This has fixed that issue but has now given another error message.

syntax error, unexpected 'echo' (T_ECHO)

Any idea what could be causing this thanks .

Chewing on Cyanide


Kindred

If you want us to help, you really need to provide the entire error, including file names and line numbers
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

WolfJ

Quote from: Kindred on August 23, 2021, 03:34:57 PMIf you want us to help, you really need to provide the entire error, including file names and line numbers

Don't mean to be rude but I posted in another post about this is all I had for the error logs.

Quote from: Legosi on August 21, 2021, 03:20:24 PMThis is all I see on the error log. Nothing else. I wish I knew what was causing this.

You cannot view this attachment.

And the same kind of thing again. I've been using SMF software since 2008, if I had the error and the line numbers I would post them. More to the point I'd fix it myself but I don't have them so that's why I came here helping someone could help.
You cannot view this attachment.

Chewing on Cyanide


shadav

in your admin under configuration then under security and moderation
checkmark Include database query in the error log

in your admin under configuration then under server settings
checkmark Disable evaluation of templates

this mod is also helpful to install for narrowing down errors
https://custom.simplemachines.org/mods/index.php?mod=4249

Arantor

Or you could do what I did, grab the fil, run php -l, see where the error is. The error in this case is the wrong number of brackets on the above posted code.

It should be:
if ($context['user']['is_admin'] && (!empty($member['post_percent'])))

WolfJ

Quote from: shadav on August 24, 2021, 02:27:51 PMin your admin under configuration then under security and moderation
checkmark Include database query in the error log

in your admin under configuration then under server settings
checkmark Disable evaluation of templates

this mod is also helpful to install for narrowing down errors
https://custom.simplemachines.org/mods/index.php?mod=4249

Thanks, I will have a look at that mod.



Quote from: Arantor on August 24, 2021, 02:33:28 PMOr you could do what I did, grab the fil, run php -l, see where the error is. The error in this case is the wrong number of brackets on the above posted code.

It should be:
if ($context['user']['is_admin'] && (!empty($member['post_percent'])))

Sorry I didn't know as I've not had them issues before. Just trying to figure this out.

Chewing on Cyanide


WolfJ

Quote from: Arantor on August 24, 2021, 02:33:28 PMOr you could do what I did, grab the fil, run php -l, see where the error is. The error in this case is the wrong number of brackets on the above posted code.

It should be:
if ($context['user']['is_admin'] && (!empty($member['post_percent'])))

This has fixed the member list page. Thank you very much.

Chewing on Cyanide


GL700Wing

Quote from: Arantor on August 24, 2021, 02:33:28 PMOr you could do what I did, grab the fil, run php -l, see where the error is. The error in this case is the wrong number of brackets on the above posted code.

It should be:
if ($context['user']['is_admin'] && (!empty($member['post_percent'])))
Just curious - the code I posted had two opening brackets and two closing brackets - why does the '!empty' test also need to be enclosed in brackets?
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Arantor

I'll be honest, I think what happened is what I think the OP did: I fixed the first missing bracket - and I didn't fix the other one. I didn't even see that you'd changed it, I'm sorry. I just assumed that since it was listed as not fixing it, I fixed the symptom that was pointed out, ran it through php -l to avoid guesswork about what was wrong, and noted a mismatch of brackets.

You don't need the third bracket, as long as the correct number of brackets is present.

GL700Wing

Quote from: Arantor on August 25, 2021, 01:39:29 PMYou don't need the third bracket, as long as the correct number of brackets is present.
No problems - that's what I thought.

Seems whoever made the manual edits to the template file originally - perhaps the OP - didn't know enough about PHP coding to edit it correctly.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: