SimplePortal
Support => English Support => Topic started by: edi67 on April 07, 2009, 02:56:40 PM
-
I saw in options that in Board NEws i can add topic of one section only is possible add topics of 2 or 3 different sections?
-
That block doesn't support showing posts from multiple boards. Although if you post your SMF version then I can post some edits that you can make so that it will allow you to do that.
-
That block doesn't support showing posts from multiple boards. Although if you post your SMF version then I can post some edits that you can make so that it will allow you to do that.
2.0 RC1 thx for help, i wanted show in board news ONLY topics of certains board not topcs of all boards
-
Edits for the 'SPortal2.php' file.
These edits will mean that you can enter a list of board IDs separated by commas into the 'Board ID' field. Eg '1,45,3,2'.
Find this code:
$block_parameters = array(
'board' => 'int',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);
if ($return_parameters)
return $block_parameters;
$board = !empty($parameters['board']) ? (int) $parameters['board'] : null;
Replace with this code:
$block_parameters = array(
'board' => 'text',
'limit' => 'int',
'start' => 'int',
'length' => 'int',
'avatar' => 'check',
'per_page' => 'int',
);
if ($return_parameters)
return $block_parameters;
$boards = !empty($parameters['board']) ? explode(',', $parameters['board']) : array();
foreach ($boards as $id_board => $board)
{
$board = (int) $board;
if (empty($board))
unset($boards[$id_board]);
else
$boards[$id_board] = $board;
}
Find this code:
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . (empty($board) ? '{query_see_board}' : 'b.id_board = {int:current_board}') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_board' => $board,
'is_approved' => 1,
'limit' => $limit,
)
);
Replace with this code:
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . (empty($boards) ? '{query_see_board}' : 'b.id_board IN ({array_int:current_boards})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_boards' => $boards,
'is_approved' => 1,
'limit' => $limit,
)
);
-
Edits for the 'SPortal2.php' file.
These edits will mean that you can enter a list of board IDs separated by commas into the 'Board ID' field. Eg '1,45,3,2'.
please sticky me in bold the part of code where i must add board id , i cannot understand :(
thx
-
You put them into the 'Board ID' field that is shown when you edit/add a Board News block. ;)
-
You put them into the 'Board ID' field that is shown when you edit/add a Board News block. ;)
work like a chamr thx ;) but there is one problem big for me, now every user groups can view topics in portal but can view too topic of sections where are NOT enabled to view, i means, there are some sections in my forum that some user groups cannot view, and now topics of these sections are visible for disable user groups too
is possible fix this?
tha anyway
-
please you can reply me to my last question thx.
-
The Board News block assumes that you are only showing topics/boards that you want all users to see.
Replace this code:
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . (empty($boards) ? '{query_see_board}' : 'b.id_board IN ({array_int:current_boards})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_boards' => $boards,
'is_approved' => 1,
'limit' => $limit,
)
);
With this code:
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE {query_see_board}
AND b.id_board IN ({array_int:current_boards})' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_boards' => $boards,
'is_approved' => 1,
'limit' => $limit,
)
);
-
work good now with permission, but one little question not inerent this.
Why the TAG (CODE, QUOTE etc) are not showed in correct way ?
look screenshot, portal not show CODE with code style but with the TAG look screen for understand.
but not problem for it , thx for help everything is ok ;)
-
Looks like the post is being cut off in the middle of the Code tags, although it should be able to cope with that.
This is either an SMF or SP bug.
-
That block doesn't support showing posts from multiple boards. Although if you post your SMF version then I can post some edits that you can make so that it will allow you to do that.
How about SMF version 1.1.8? Anyway I can also fix this code in order to display multiple boards on the Frontpage block?
-
For SMF 1.1.8:
Replace this code:
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE " . (empty($board) ? $user_info['query_see_board'] : "b.ID_BOARD = $board") . "
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $limit", __FILE__, __LINE__);
With this code:
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE $user_info[query_see_board]" . (empty($board) ? '' : "
b.ID_BOARD = $board") . "
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $limit", __FILE__, __LINE__);)
-
Thank you for the reply.
I applied the code changes you suggested for 1.1.8 and also do the code changes mentioned above for the "$block_parameters".
However, when previewing the Board News block I receive the following:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'b.ID_BOARD = 2
ORDER BY t.ID_FIRST_MSG DESC
LIMIT 5' at line 5
File: /home8/xxxx/public_html/Sources/SPortal1-1.php
Line: 1344
Any ideas where this is coming from and how I can fix this?
-
Whoops, try this:
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE $user_info[query_see_board]' . (empty($board) ? '' : '
AND b.id_board IN (' . implode(',', $boards) . ')') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $limit", __FILE__, __LINE__);
-
Hi LHVWB,
Thank you for your help so far.
Unfortunately I now receive the following error message:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home8/xxxx/public_html/Sources/SPortal1-1.php on line 1342
I've been trying for some hours now trying to fix this on my own, but it's pretty obvious my skills are not that good as I might have hoped :-X
Any suggestions?
-
Sigh, not having any luck today. Shows what happens when I am not concentraiting.
The code below should work:
SELECT ID_FIRST_MSG
FROM {$db_prefix}topics AS t
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = t.ID_BOARD)
WHERE $user_info[query_see_board]" . (empty($board) ? '' : "
AND b.id_board IN (" . implode(',', $boards) . ')') . ($modSettings['postmod_active'] ? "
AND t.approved = {int:is_approved}" : '') . "
ORDER BY t.ID_FIRST_MSG DESC
LIMIT $limit", __FILE__, __LINE__);;
-
Ahh that did the trick for me :D
Thanks for your help.
-
./Sources
-
You are running SMF 1.1.8, so the file is at '{smf directory}/sources/Subs-SPortal1-1.php'. ;)
-
SMF 1.1.9 is essentially the same as SMF 1.1.8, the file that you need to edit is still at '{smf directory}/sources/Subs-SPortal1-1.php'.
-
You are running SMF 1.1.8, so the file is at '{smf directory}/sources/Subs-SPortal1-1.php'. ;)
Make sure the "S" in "sources" is capitalized.
-
No, sorry, the edits are for the '{smf directory}/Sources/SPortal1-1.php' file. :/
If you attach that file then I can do the edits for you. :)
-
The Board News block assumes that you are only showing topics/boards that you want all users to see.
Replace this code:
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE ' . (empty($boards) ? '{query_see_board}' : 'b.id_board IN ({array_int:current_boards})') . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_boards' => $boards,
'is_approved' => 1,
'limit' => $limit,
)
);
With this code:
$request = $smcFunc['db_query']('', '
SELECT id_first_msg
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
WHERE {query_see_board}
AND b.id_board IN ({array_int:current_boards})' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '') . '
ORDER BY t.id_first_msg DESC
LIMIT {int:limit}',
array(
'current_boards' => $boards,
'is_approved' => 1,
'limit' => $limit,
)
);
i need help please in simpleportal 2.3 where i can find that code to edit ?