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 '('
what mods have you installed that edited the memberlist files?
Also attach your sources/memberlist.php
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.
Memberlist.php
Thanks for the help
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?
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.
And it doesn't say the file or line number? in the error log???
This is all I see on the error log. Nothing else. I wish I knew what was causing this.
Member List Error.JPG
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
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']
)
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
Memberlist.template.php
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!
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']))
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 .
If you want us to help, you really need to provide the entire error, including file names and line numbers
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.
Member List Error.JPG
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.
Member List Error 2.JPG
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
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'])))
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.
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.
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?
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.
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.