News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Functionality requests for SSI in the next version of SMF

Started by Grudge, December 25, 2006, 04:01:55 AM

Previous topic - Next topic

Grudge

All,

As part of the new features to be added in the next version of SMF I'd like to further expand the SSI functions available - but I need the communities input. Apologies in advance for not trawling through the countless threads that have no doubt requested things in the past but I would like to keep it all together - hence this topic.

So - what additions would you like to SSI in the next release? Are there any things you've been hacking in the last couple of years that you think should be part of the core code? If you can provide some suggestions I'll collect them all together - consider them with the team here - and let you guys know what the outcome will be.

Regards,

Grudge
I'm only a half geek really...

Daniel15

The main thing I'd like would be a function to retrieve individual posts (I'm sure there's a mod for that somewhere, but I haven't looked around). Also, a variant of the ssi_recentTopics function, which accepts board ID's to include rather than exclude :).
I can't think of anything else at the moment, although I probably will later (I'll be back :P)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Ben_S

Liverpool FC Forum with 14 million+ posts.

Rudolf

Here's one
What the SSI needs is more flexibility, with the modified code I can write external pages just like they would be an extra action in the forum. With the current one it's bit more difficult.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

nitins60

ssi_theme = "1";

there is no option for selection theme of forum, it doesn't matter theme number! When administrator change theme, so it should also change according to theme rather than changing theme number!
ssi_theme="auto"; something like s good!

yomasta3

Just put everything in SMF_API.php into SSI.php. That would help me a ******load more then having 2 files that interfere with eachother. lol.

Grudge

Quote from: nitins60 on December 29, 2006, 12:41:43 PM
ssi_theme = "1";

there is no option for selection theme of forum, it doesn't matter theme number! When administrator change theme, so it should also change according to theme rather than changing theme number!
ssi_theme="auto"; something like s good!
But if you simply don't set $ssi_theme then it will do auto anyway?
I'm only a half geek really...

nitins60

But i have tested it, there is some difference using ssi_theme! When i don't use this, it loads theme template, but doesn't retrieve style.Css!

1MileCrash

I was thinking, wouldn't it be great if hitting "reply" to SSI_boardnews or the like brought us back to the page the function was on?

I have this: If it would appeal to others. Each topic in a specific board has a page automatically created with replies and a link added. I think it's alot like what ben has but i haven't looked at his really well yet.

http://model98.org/reviews.php?

The only thing php can't do is tell you how much milk is left in the fridge.



Panzer-

There already is the ssi_menubar (Not sure on the exact name). I was wondering if there could be an ssi_boarddisplay, basically it would show the board and footer but no navigation bar/menubar/header. That way people could incorporate SMF into their websites easier.

1MileCrash

Quote from: Panzer- on January 04, 2007, 11:21:30 PM
There already is the ssi_menubar (Not sure on the exact name). I was wondering if there could be an ssi_boarddisplay, basically it would show the board and footer but no navigation bar/menubar/header. That way people could incorporate SMF into their websites easier.

I had a similar idea a while back..It would be pretty cool.
The only thing php can't do is tell you how much milk is left in the fridge.



Daniel15

QuoteThat way people could incorporate SMF into their websites easier.
What's wrong with using the layer system for incorperating SMF into a site?
Integrating the forum into your site..., second post :D
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!


Daniel15

Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Panzer-

I think personally it would help non coders with their website - forum integration.

Sarke

Hi, new around these parts.  I'm in the process of switching from IPB and I'm having a hard time with missing features that I get from IPBSDK.  By no means is IPBSDK perfect, but it does make things much easier.  I hope you'll have a look at the functions it provides and consider making similar for SSI.

Below are some functions I find very useful and would like to see in SSI (remember I'm new to SMF so if these are already there forgive me).  They're not directly from IPBSDK but inspired by it, and it's how I would have done it (probably add "ssi_" infront of the function names):

list_members($group = '') returns an array of user ids with all the members in that group (or all members if $group is left blank).

list_online_members() returns an array of the members that are currently online.

topic_info($topic_id) returns an array with info on the topic, such as subject, topic starter, array of post ids in topic, array user ids who posted in it (perhaps have the user id as the key and the value as the number of post in the topic by that user).

post_info($post_id) returns an array with info on the post, just like mentioned earlier in this topic.

member_info($user_id = '') returns an array with info about the member. False if no $user_id is specified and if the current person is not logged in.

is_online($user_id = '') returns a true or false depending on if the specified user is online. If $user_id is blank, check to see if the person viewing the page is logged in. Sort of like a reverse is_guest() function.

is_admin($user_id = '') returns a true or false depending on the specified user (or current user if blank) is an admin.

is_in_group($group_array, $user_id = '') returns a true or false depending on if the specified user (or current user if blank) is in any of the member groups specified.

I know the last few you can get through $user_info, but not for any user specified and with a bit more code.  I should also note that I find (as I'm sure many do), for example, that

if (is_admin())

is more convenient than

if ($user_info['is_admin'])

even though it's just a small change.  Functions like that are easy to code so I suggest they be included for the sake of convenience.


Thanks for your time, and keep up the good work!

My MODs          Please don't PM me for support, post in the appropriate topic.

Sarke

Another one...

name_to_id($user_name) returns the id.

My MODs          Please don't PM me for support, post in the appropriate topic.

Panzer-

IPBSDK is basically equivilant to the ssi. Except its a mod for IPB whereas its built in for SMF.

Daniel15

Sarke, a lot of the things you've suggested already exist. I'll give you some code examples:

Quotelist_online_members() returns an array of the members that are currently online.

<?php
require('SSI.php');

$online ssi_whosOnline('array');
echo 
'<pre>'print_r($onlinetrue), '</pre>';
?>



Quotemember_info($user_id = '') returns an array with info about the member.

<?php
require('SSI.php');

// By ID:
loadMemberData(1);
loadMemberContext(1);
// At this point, $memberContext[user_id] contains the user's details
echo '<pre>'print_r($memberContext[1], true), '</pre>';

// By username:
$return loadMemberData('Daniel15');
$userID $return[0];
loadMemberContext($userID);
echo 
'<pre>'print_r($memberContext[$userID], true), '</pre>';


// If you really want a function to replicate that IPB-SDK functionality :-)
function member_info($member_id)
{
loadMemberData($member_id);
loadMemberContext($member_id);
return $memberContext[$member_id];
}
?>



Quoteis_online($user_id = '') returns a true or false depending on if the specified user is online.
It's in the array retrieved above

Quoteis_admin($user_id = '') returns a true or false depending on the specified user (or current user if blank) is an admin.
I believe this is also returned in the array above.

Quoteis_in_group($group_array, $user_id = '') returns a true or false depending on if the specified user (or current user if blank) is in any of the member groups specified.
All their groups are in the array returned above

Quotename_to_id($user_name) returns the id.
Load the user's data (above), and then get the name :)

Also, note that there's heaps of information (especially on the current user) in the large $context array.
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

B Patterson

Subscribed Topic Replies
I added this to my SSI.php for use with my index.php page.  Basically, instead of using TP (too much bloat for me) I created my own index.php page and then used SSI to power it.  I created a function to get the latest unread topics that you are subscribed to.  Basically, it comes down to something like this:
function ssi_unreadReplies($output_method 'echo')
{
	
global 
$db_prefix$context$settings$scripturl;

	
$topic_ids = array();
	
$last_msg_ids = array();
	
$return = array();

	
$request db_query("SELECT MAX(lmr.ID_MSG)
	
	
	
	
FROM 
{$db_prefix}log_mark_read AS lmr
	
	
	
	
WHERE lmr.ID_MEMBER = " 
$context['user']['id'] . "
	
	
	
	
LIMIT 0, 1"
__FILE____LINE__);
	
list(
$max) = mysql_fetch_row($request);
	
mysql_free_result($request);

	
$request db_query("
	
	
SELECT m.ID_TOPIC
	
	
FROM 
{$db_prefix}log_notify AS ln
	
	
LEFT JOIN 
{$db_prefix}messages AS m
	
	
	
ON ln.ID_TOPIC = m.ID_TOPIC
	
	
WHERE ln.ID_MEMBER = '" 
$context['user']['id'] . "'
	
	
	
AND m.ID_MSG > '
{$max}'
	
	
	
AND ln.sent = '1'
	
	
GROUP BY m.ID_TOPIC
	
	
ORDER BY m.posterTime DESC"
__FILE____LINE__);

	
while(
$row mysql_fetch_assoc($request))
	
{
	
	
$topic_ids[] = $row['ID_TOPIC'];
	
}
	
mysql_free_result($request);

	
if(!empty(
$topic_ids))
	
{

	
	
if(
count($topic_ids)>1)
	
	
	
$wclause "m.ID_TOPIC IN (" implode(', '$topic_ids) . ")";
	
	
else if(
count($topic_ids == 1))
	
	
	
$wclause "m.ID_TOPIC = '" $topic_ids[0] . "'";

	
	
$request db_query("
	
	
	
SELECT m.subject, t.ID_TOPIC, 
	
	
	
	
t.ID_LAST_MSG
	
	
	
FROM 
{$db_prefix}topics AS t
	
	
	
LEFT JOIN 
{$db_prefix}messages AS m
	
	
	
	
ON t.ID_FIRST_MSG = m.ID_MSG
	
	
	
WHERE " 
$wclause__FILE____LINE__);

	
	
while(
$row mysql_fetch_assoc($request))
	
	
{
	
	
	
$last_msg_ids[] = $row['ID_LAST_MSG'];

	
	
	
$return[$row['ID_TOPIC']]['topic'] = array(
	
	
	
	
'id' => $row['ID_TOPIC'],
	
	
	
	
'subject' => $row['subject'],
	
	
	
	
'short_subject' => shorten_subject($row['subject'], 30)
	
	
	
);
	
	
	

	
	
}
	
	
mysql_free_result($request);

	
	
$request db_query("
	
	
	
SELECT m.posterName, m.posterTime, m.smileysEnabled, m.body, m.ID_TOPIC, m.ID_MSG
	
	
	
FROM 
{$db_prefix}messages AS m
	
	
	
WHERE m.ID_MSG IN (" 
implode(', '$last_msg_ids) . ")
	
	
	
"
__FILE____LINE__);

	
	
while(
$row mysql_fetch_assoc($request))
	
	
{

	
	
	
$row['body'] = parse_bbc($row['body'], $row['smileysEnabled'], $row['ID_MSG']);
	
	
	
	

	
	
	
if (
strlen($row['body']) > 512)
	
	
	
	
$row['body'] = substr($row['body'], 0512) . '...';

	
	
	
censorText($row['subject']);
	
	
	
censorText($row['body']);

	
	
	
$return[$row['ID_TOPIC']]['post'] = array(
	
	
	
	
	
'poster' => $row['posterName'],
	
	
	
	
	
'timestamp' => forum_time(true$row['posterTime']),
	
	
	
	
	
'time' => timeformat($row['posterTime']),
	
	
	
	
	
'href' => $scripturl '?topic=' $row['ID_TOPIC'] . '.new;topicseen#new',
	
	
	
	
	
'preview' => substr($row['body'], 0102) . '...',
	
	
	
	
	
'body' => $row['body']
	
	
	
);
	
	
}
	
	
mysql_free_result($request);
	
}

	
if(
$output_method != 'echo' || empty($return))
	
	
return 
$return;

	
echo 
'
	
<table>
	
	
<tr>
	
	
	
<th>Subject</th><th>Poster</th><th>Posted</th>
	
	
</tr>'
;
	
if(!empty(
$return))
	
	
foreach(
$return as $topic)
	
	
{
	
	
	
echo 
'
	
	
<tr>
	
	
	
<table>
	
	
	
	
<tr>
	
	
	
	
	
<td style="border-top, border-left: 1px solid #000;">' 
$topic['link'] . '</td>
	
	
	
	
	
<td style="border-top: 1px solid #000;">' 
$topic['poster'] . '</td>
	
	
	
	
	
<td style="border-top, border-right: 1px solid #000;">' 
$topic['time'] . '</td>
	
	
	
	
</tr>
	
	
	
	
<tr>
	
	
	
	
	
<td colspan="3" style="border: 1px solid #000; border-top: 1px solid #ccc; background-color: #ccc">' 
$topic['preview'] . '</td>
	
	
	
	
</tr>
	
	
	
</table>
	
	
</tr>'
;
	
	
}
	
else
	
	
echo 
'
	
	
<tr>
	
	
	
<td colspan="3">No messages to display...</td>
	
	
</tr>'
;
	
echo 
'
	
</table>'
;
}


You can see this in action at www.roundcubeforum.net.  I love the feature it adds.  And so do my users.  When they log in from the front page, they can immediately see exactly what posts have been active for them.  This is very much the same as what vB has under the user Control Panel.

Advertisement: