News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Recent posts user preference

Started by miseryshining, March 19, 2007, 05:37:32 PM

Previous topic - Next topic

Mimmi

I have an error I can't figure out:

When trying to go to
http://.../index.php?action=profile I get:

QuoteParse error: syntax error, unexpected T_ISSET, expecting '&' or T_VARIABLE in /.../Sources/Profile.php on line 947

The line reads:
QuotemakeThemeChanges($memID, isset($_POST['ID_THEME']) ? (int) $_POST['ID_THEME'] : $old_profile['ID_THEME']);

What should I do?
Forum-junkie and still a newbie in the world of administrating php etc... Volunteers in reproductive rights. http://www.liv-laga.no/

miseryshining

Quote from: Mimmi on June 13, 2008, 05:50:15 PM
I have an error I can't figure out:

When trying to go to
http://.../index.php?action=profile I get:

QuoteParse error: syntax error, unexpected T_ISSET, expecting '&' or T_VARIABLE in /.../Sources/Profile.php on line 947

The line reads:
QuotemakeThemeChanges($memID, isset($_POST['ID_THEME']) ? (int) $_POST['ID_THEME'] : $old_profile['ID_THEME']);

What should I do?


can you also post the surrounding lines of code please?

Mimmi

Quote from: miseryshining on June 14, 2008, 06:53:51 AM
can you also post the surrounding lines of code please?

The problem is solved. I think it had something to do with the following error: I upgraded the forum from the Administration Center and thought I then was using the 1.1.5 version, but it failed without me understanding it, so I was still using 1.1.4. My cousin, who owns the server, upgrated to 1.1.5 manually. After that he tried to install the mod package, but somehow it didn't work out. When I installed the mod manually, the error disappeared. I did however encounter another problem. I'll put that in a new post.

I put the original problem code here just in case you or someone else may use it:
// Make any theme changes that are sent with the profile..
function 
makeThemeChanges($memID, isset($_POST['ID_THEME']) ? (int) $_POST['ID_THEME'] : $old_profile['ID_THEME']);
makeRecentPostsChanges($memID)
{
global $db_prefix, $modSettings;

// These are the theme changes...
$themeSetArray = array();
if (isset($_POST['options']) && is_array($_POST['options']))
{
foreach ($_POST['options'] as $opt => $val)
$themeSetArray[] = '(' . $memID . ', ' . $ID_THEME . ", SUBSTRING('" . addslashes($opt) . "', 1, 255), SUBSTRING('" . (is_array($val) ? implode(',', $val) : $val) . "', 1, 65534))";
}

$erase_options = array();
if (isset($_POST['default_options']) && is_array($_POST['default_options']))
foreach ($_POST['default_options'] as $opt => $val)
{
$themeSetArray[] = "($memID, 1, SUBSTRING('" . addslashes($opt) . "', 1, 255), SUBSTRING('" . (is_array($val) ? implode(',', $val) : $val) . "', 1, 65534))";
$erase_options[] = addslashes($opt);
}

// If themeSetArray isn't still empty, send it to the database.
if (!empty($themeSetArray))
{
db_query("
REPLACE INTO {$db_prefix}themes
(ID_MEMBER, ID_THEME, variable, value)
VALUES " . implode(",
", $themeSetArray), __FILE__, __LINE__);
}

if (!empty($erase_options))
{
db_query("
DELETE FROM {$db_prefix}themes
WHERE ID_THEME != 1
AND variable IN ('" . implode("', '", $erase_options) . "')
AND ID_MEMBER = $memID", __FILE__, __LINE__);
}

$themes = explode(',', $modSettings['knownThemes']);
foreach ($themes as $t)
cache_put_data('theme_settings-' . $t . ':' . $memID, null, 60);
}
Forum-junkie and still a newbie in the world of administrating php etc... Volunteers in reproductive rights. http://www.liv-laga.no/

Mimmi

#243
As I said in the post above I encountered a problem when trying to install the mod manually on forum version 1.1.5:

When trying to open http://.../index.php?action=recent I got the following error message:

Template Parse Error!
There was a problem loading the /Themes/default/Recent.template.php template or language file.  Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\).  To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

      


      syntax error, unexpected ','

I compared the Recent.template.php from my first and last installation of the mod and decided to to use the old version of the file. Then everythin worked fine, except for one thing: I can't access the Recent post settings. The link is there both in the Administration panel and in my Profile, but when I click on it nothing happens in the Admin and in my Profile I get an error message:
QuoteAn Error Has Occurred!
Unable to load the 'recentPosts' template.

I guess there is just some small detail I haven't understood or done right... I apologize, I'm not familiar with php code...  :-[

I attach a Word-file that shows the difference between the old and new version of Recent.template.php. The text in red is from the new (failed) version.

By the way: This is how the mod works:
http://.../index.php?action=recenttopics looks like the image here.
http://.../index.php?action=recent looks like it's always done.
Forum-junkie and still a newbie in the world of administrating php etc... Volunteers in reproductive rights. http://www.liv-laga.no/

miseryshining

Quote from: Mimmi on June 15, 2008, 06:53:52 AM
As I said in the post above I encountered a problem when trying to install the mod manually on forum version 1.1.5:

When trying to open http://.../index.php?action=recent I got the following error message:

Template Parse Error!
There was a problem loading the /Themes/default/Recent.template.php template or language file.  Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\).  To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

      


      syntax error, unexpected ','

I compared the Recent.template.php from my first and last installation of the mod and decided to to use the old version of the file. Then everythin worked fine, except for one thing: I can't access the Recent post settings. The link is there both in the Administration panel and in my Profile, but when I click on it nothing happens in the Admin and in my Profile I get an error message:
QuoteAn Error Has Occurred!
Unable to load the 'recentPosts' template.

I guess there is just some small detail I haven't understood or done right... I apologize, I'm not familiar with php code...  :-[

I attach a Word-file that shows the difference between the old and new version of Recent.template.php. The text in red is from the new (failed) version.

By the way: This is how the mod works:
http://.../index.php?action=recenttopics looks like the image here.
http://.../index.php?action=recent looks like it's always done.

you made a mistake in this line (160):

<img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" style="margin: 0;" />' : '', $topic['first_post']['link'], $topic['is_read'] == 0 ? ' <a href="',. $topic['new_href'],]. '"><img src="',. $settings['images_url'],]. '/',. $context['user']['language'],]. '/new.gif" alt="',. $txt[302],]. '" /></a> ' : '', '<span class="smalltext">', $topic['pages'], ' ', $txt['smf88'], ' ', $topic['board']['link'], '</span></td>

replace it with this (from the mod):

<img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" style="margin: 0;" />' : '', $topic['first_post']['link'], $topic['is_read'] == 0 ? ' <a href="'. $topic['new_href']. '"><img src="'. $settings['images_url']. '/'. $context['user']['language']. '/new.gif" alt="'. $txt[302]. '" /></a>' : '', '<span class="smalltext">', $topic['pages'], ' ', $txt['smf88'], ' ', $topic['board']['link'], '</span></td>

and you made some mistakes here as well:

<td>> <a href="', $scripturl, '?action=unreadreplies'', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[70], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a>> </td>
<td width="14%">%"> <a href="', $scripturl, '?action=unreadreplies'', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[109], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a>> </td>
<td width="4%" align="center">"> <a href="', $scripturl, '?action=unreadreplies'', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[110], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a>> </td>
<td width="4%" align="center">"> <a href="', $scripturl, '?action=unreadreplies'', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[301], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a>> </td>
<td width="24%">%"> <a href="', $scripturl, '?action=unreadreplies'', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[111], $context['sort_by'] == 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a>> </td>';


replace with this:

<td> <a href="', $scripturl, '?action=unreadreplies', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=subject', $context['sort_by'] == 'subject' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[70], $context['sort_by'] == 'subject' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a> </td>
<td width="14%"> <a href="', $scripturl, '?action=unreadreplies', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=starter', $context['sort_by'] == 'starter' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[109], $context['sort_by'] == 'starter' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a> </td>
<td width="4%" align="center"> <a href="', $scripturl, '?action=unreadreplies', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[110], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a> </td>
<td width="4%" align="center"> <a href="', $scripturl, '?action=unreadreplies', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[301], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a> </td>
<td width="24%"> <a href="', $scripturl, '?action=unreadreplies', isset($_REQUEST['action']) ? $_REQUEST['action'] : 'unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], isset($context['querystring_day_limits']) ? $context['querystring_day_limits'] : '', ';sort=last_post', $context['sort_by'] == 'last_post' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt[111], $context['sort_by'] == 'last_post' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" border="0" />' : '', '</a> </td>';


it looked pretty messed up so i can't guarantee that this fixes everything.

miseryshining

new version posted:

-3.00 adds support for 2.0 beta 3.*, admin settings are moved to configuration->modifications.

please test! (quite some under the hood changes..)

Mimmi

Quote from: miseryshining on June 15, 2008, 10:05:44 AM

it looked pretty messed up so i can't guarantee that this fixes everything.

I found a couple of other mistakes to (in red) and now it worked out. At least I don't get the Template Parse Error! message anymore, but I'm still not able to access the Recent post settings. Any suggestion?
Forum-junkie and still a newbie in the world of administrating php etc... Volunteers in reproductive rights. http://www.liv-laga.no/

miseryshining

Quote from: Mimmi on June 15, 2008, 01:37:59 PM
Quote from: miseryshining on June 15, 2008, 10:05:44 AM

it looked pretty messed up so i can't guarantee that this fixes everything.

I found a couple of other mistakes to (in red) and now it worked out. At least I don't get the Template Parse Error! message anymore, but I'm still not able to access the Recent post settings. Any suggestion?

the ones inside the profile you mean? or in the admin panel?

Mimmi

Quote from: miseryshining on June 15, 2008, 03:39:20 PM
Quote from: Mimmi on June 15, 2008, 01:37:59 PM
Quote from: miseryshining on June 15, 2008, 10:05:44 AM

it looked pretty messed up so i can't guarantee that this fixes everything.

I found a couple of other mistakes to (in red) and now it worked out. At least I don't get the Template Parse Error! message anymore, but I'm still not able to access the Recent post settings. Any suggestion?

the ones inside the profile you mean? or in the admin panel?

Both, as I described above:
I can't access the Recent post settings. The link is there both in the Administration panel and in my Profile, but when I click on it nothing happens in the Admin and in my Profile I get an error message:
QuoteAn Error Has Occurred!
Unable to load the 'recentPosts' template.
Forum-junkie and still a newbie in the world of administrating php etc... Volunteers in reproductive rights. http://www.liv-laga.no/

miseryshining

Quote from: Mimmi on June 15, 2008, 04:10:38 PM
Quote from: miseryshining on June 15, 2008, 03:39:20 PM
Quote from: Mimmi on June 15, 2008, 01:37:59 PM
Quote from: miseryshining on June 15, 2008, 10:05:44 AM

it looked pretty messed up so i can't guarantee that this fixes everything.

I found a couple of other mistakes to (in red) and now it worked out. At least I don't get the Template Parse Error! message anymore, but I'm still not able to access the Recent post settings. Any suggestion?

the ones inside the profile you mean? or in the admin panel?

Both, as I described above:
I can't access the Recent post settings. The link is there both in the Administration panel and in my Profile, but when I click on it nothing happens in the Admin and in my Profile I get an error message:
QuoteAn Error Has Occurred!
Unable to load the 'recentPosts' template.

hmm, it seems many things got scrambled in your install, im afraid i cant really help you other then advising to start with a fresh forum install if you can.

Mimmi

Quote from: miseryshining on June 15, 2008, 05:07:18 PM
hmm, it seems many things got scrambled in your install, im afraid i cant really help you other then advising to start with a fresh forum install if you can.

I haven't done a fresh install, but: Hurray! I located one mistake :D: In the /Sources/ModSettings.php the  'recentposts' => 'ModifyRecentpostsSettings', should be added before the  'karma' => 'ModifyKarmaSettings', twice. I had only did it once! So now I can make changes in the Recent posts/topics in the Administration panel, but I still get the same error message trying to access it from my Profile. I'll get back if I find a solution for that problem too.
Forum-junkie and still a newbie in the world of administrating php etc... Volunteers in reproductive rights. http://www.liv-laga.no/

Mimmi

I found the second mistake to! In the /Themes/default/Profile.template.php I had added the script as described on the manual installation guide, but when pasting it into Dreamweaver all line breaks etc disappeared. I always tried to put them back in again in the right places, but here I missed the most important one: the one between
// Template for showing recent posts settings and
. function template_recentPosts()

Now everything works great and I'm thrilled! So will my users be, I love this mod!  :D :D :D
Forum-junkie and still a newbie in the world of administrating php etc... Volunteers in reproductive rights. http://www.liv-laga.no/

miguelito

#252
Quote from: miseryshining on June 15, 2008, 12:03:14 PM
new version posted:

-3.00 adds support for 2.0 beta 3.*, admin settings are moved to configuration->modifications.

please test! (quite some under the hood changes..)

packages installed:
Alias boards
single category.

default theme.

I tried to installl this mod(recent post)

admin link exist, but nothing appears
user profile link exist, and be able to make changes in his config.
also index.php  died:

Fatal error: require_once() [function.require]: Failed opening required '/home/mydir/public_html/foro/Sources/SSI.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mydir/public_html/foro/Sources/Load.php on line 2252

some help??
i do need this mod , thanks :D
http://foro.cometas.info [nofollow] - SMF beta 3 public

miseryshining

Quote from: miguelito on June 17, 2008, 08:07:09 PM
Quote from: miseryshining on June 15, 2008, 12:03:14 PM
new version posted:

-3.00 adds support for 2.0 beta 3.*, admin settings are moved to configuration->modifications.

please test! (quite some under the hood changes..)

packages installed:
Alias boards
single category.

default theme.

I tried to installl this mod(recent post)

admin link exist, but nothing appears
user profile link exist, and be able to make changes in his config.
also index.php  died:

Fatal error: require_once() [function.require]: Failed opening required '/home/mydir/public_html/foro/Sources/SSI.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/mydir/public_html/foro/Sources/Load.php on line 2252

some help??
i do need this mod , thanks :D


you're on beta3?
did you include SSI_recentPostsPrefs() somewhere in your templates? got any errors during install?

miguelito

hi, thanks for your fast response.

It´s a  beta 3.1, quite clean installation, only migrated the data to the new database.

i´m triyng it with  default theme, not touched yet. ( waiting for beta4 to start with it )

No prob installing.

Only have the 2 mods i wrote:alias boards and single category.

I did not touch the templates. only run the install from the admin panel. Do I miss something??

thanks.
sorry for my english, i´m from Spain.


http://foro.cometas.info [nofollow] - SMF beta 3 public

miseryshining

Quote from: miguelito on June 18, 2008, 08:04:09 AM
hi, thanks for your fast response.

It´s a  beta 3.1, quite clean installation, only migrated the data to the new database.

i´m triyng it with  default theme, not touched yet. ( waiting for beta4 to start with it )

No prob installing.

Only have the 2 mods i wrote:alias boards and single category.

I did not touch the templates. only run the install from the admin panel. Do I miss something??

thanks.
sorry for my english, i´m from Spain.




Thanks for your feedback, i just released a new version that should fix both problems:

-3.01 fixes a major bug when using a recent posts list on the board index. It also fixes the admin settings not displaying.

msvdm

Hi i uss 2.0 Beta 3.1 Public
when i try to install the mod i get this error :

An Error Has Occurred!
The package you are trying to download or install is either corrupt or not compatible with this version of SMF. 

evil-angelist

It seems to be the same on 1.1.5 as well. Lets hope this gets fixed soon ;)

Quote from: msvdm on June 22, 2008, 05:18:13 AM
Hi i uss 2.0 Beta 3.1 Public
when i try to install the mod i get this error :

An Error Has Occurred!
The package you are trying to download or install is either corrupt or not compatible with this version of SMF. 


miseryshining

Quote from: evil-angelist on June 22, 2008, 06:40:30 AM
It seems to be the same on 1.1.5 as well. Lets hope this gets fixed soon ;)

Quote from: msvdm on June 22, 2008, 05:18:13 AM
Hi i uss 2.0 Beta 3.1 Public
when i try to install the mod i get this error :

An Error Has Occurred!
The package you are trying to download or install is either corrupt or not compatible with this version of SMF. 


Apparently SMF doesnt like the zipfiles that are created on my Linux distribution.. Its now replaced with a tar.gz package.

miguelito

Quote from: miseryshining on June 21, 2008, 09:15:48 PM
Quote from: miguelito on June 18, 2008, 08:04:09 AM
hi, thanks for your fast response.

It´s a  beta 3.1, quite clean installation, only migrated the data to the new database.

i´m triyng it with  default theme, not touched yet. ( waiting for beta4 to start with it )
No prob installing.

Only have the 2 mods i wrote:alias boards and single category.

I did not touch the templates. only run the install from the admin panel. Do I miss something??

thanks.
sorry for my english, i´m from Spain.




Thanks for your feedback, i just released a new version that should fix both problems:

-3.01 fixes a major bug when using a recent posts list on the board index. It also fixes the admin settings not displaying.

works like a charm...
great work.

i´m traslating to spanish
http://foro.cometas.info [nofollow] - SMF beta 3 public

Advertisement: