<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : Sticky post</title>
		<link>https://www.cotonti.com</link>
		<description>Останні повідомлення в темі</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Sat, 11 Apr 2026 23:50:24 -0000</pubDate>

		<item>
			<title>SunChase</title>
			<description><![CDATA[<blockquote>I'll put out it as a core hack,but If someone wants he can make a plugin out of this.</blockquote>
<br />
it can be done as a plugin,but when i asked for help on making a plugin out of this i got no answer...]]></description>
			<pubDate>Пт, 20 Лис 2009 03:28:16 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=4978&d=0#post21069]]></link>
		</item>
		<item>
			<title>pieter</title>
			<description><![CDATA[Can' this be done with a plugin?]]></description>
			<pubDate>Пт, 20 Лис 2009 02:41:17 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=4978&d=0#post21067]]></link>
		</item>
		<item>
			<title>SunChase</title>
			<description><![CDATA[Here i will post a realization of a one little addon for forums,which is done in most other forum systems.I'll put out it as a core hack,but If someone wants he can make a plugin out of this.<br />
The idea is to &quot;stick&quot; a random forum post in the topic(through out the topic pages).<br />
<br />
<strong>Step 1.Adding 1 field to the DB.</strong><br />
We need to add a column in the forum_posts.For this just run:<br />
<pre class="code">ALTER TABLE `sed_forum_posts` ADD COLUMN `fs_poststicker` tinyint(1) NOT NULL&#093;</pre>
<br />
<strong>Step 2.Adding a &quot;Stick first post&quot; option in the New topic.(File: posts.newtopic.inc.php)</strong><br />
<br />
Dont remember for what i'w put in this string,but:<br />
<pre class="code">$sticky = sed_import('stickypost','P','BOL');</pre>
<br />
Edit the sql_insert:<br />
<pre class="code">	$sql = sed_sql_query(&quot;INSERT into $db_forum_topics
		(ft_state,
		ft_mode,
		ft_sticky,
		ft_sectionid,
		ft_title,
		ft_desc,
		ft_preview,
		ft_creationdate,
		ft_updated,
		ft_postcount,
		ft_viewcount,
		ft_firstposterid,
		ft_firstpostername,
		ft_lastposterid,
		ft_lastpostername)
		VALUES
		(0,
			&quot;.(int)$newprvtopic.&quot;,
			0,
			&quot;.(int)$s.&quot;,
			'&quot;.sed_sql_prep($newtopictitle).&quot;',
			'&quot;.sed_sql_prep($newtopicdesc).&quot;',
			'&quot;.sed_sql_prep($newtopicpreview).&quot;',
			&quot;.(int)$sys&#091;'now_offset'&#093;.&quot;,
			&quot;.(int)$sys&#091;'now_offset'&#093;.&quot;,
			1,
			0,
			&quot;.(int)$usr&#091;'id'&#093;.&quot;,
			'&quot;.sed_sql_prep($usr&#091;'name'&#093;).&quot;',
			&quot;.(int)$usr&#091;'id'&#093;.&quot;,
			'&quot;.sed_sql_prep($usr&#091;'name'&#093;).&quot;')&quot;);
</pre>
<br />
The sticker option<br />
<pre class="code">$sticky = &quot;&lt;input type=\&quot;checkbox\&quot; name=\&quot;stickypost\&quot; value=\&quot;1\&quot;&gt;&quot;;
$t-&gt;assign(array(
&quot;STICKY_POST&quot; =&gt; $sticky,
));
</pre>
<br />
<strong>Step 3.Adding a similar option to every post.(File: posts.editpost.inc.php)</strong><br />
<pre class="code">if($usr&#091;'isadmin'&#093;)
  {
$sqk = sed_sql_query(&quot;select fp_id,fs_poststicker from $db_forum_posts WHERE fp_id='$p' LIMIT 1&quot;);
$rows = sed_sql_fetcharray($sqk);
$checked = ($rows&#091;'fs_poststicker'&#093;)=='1' ? &quot;checked=\&quot;checked\&quot;&quot; : '';
$sticky = &quot;&lt;input type=\&quot;checkbox\&quot; name=\&quot;stickypost\&quot; value=\&quot;1\&quot; $checked&gt;&quot;;
$t-&gt;assign(array(
&quot;STICKY_POST&quot; =&gt; $sticky,
));
$t-&gt;parse(&quot;MAIN.STICKY&quot;);
}</pre>
<br />
<strong>Step 4.Last.(File: posts.posts.inc.php)</strong><br />
<br />
The first thing is to add a sql_select for this posts(with a mark that it is sticky).<br />
<br />
this part can be optimized ,but it should work fine without it:<br />
<div style="margin:4px 0px 4px 0px"><input type="button" value="step 4" onclick="if(this.parentNode.getElementsByTagName('div')[0].style.display != '') { this.parentNode.getElementsByTagName('div')[0].style.display = ''; } else { this.parentNode.getElementsByTagName('div')[0].style.display = 'none'; }" /><div style="display:none" class="spoiler"><pre class="code">$sqlr = sed_sql_query(&quot;SELECT p.*, u.user_text, u.user_maingrp, u.user_avatar, u.user_photo, u.user_signature,
u.user_country, u.user_occupation, u.user_location, u.user_website, u.user_email, u.user_hideemail, u.user_gender, u.user_birthdate,
u.user_postcount
FROM $db_forum_posts p,$db_users u
WHERE fp_topicid='$q'
AND u.user_id=p.fp_posterid
AND p.fs_poststicker = '1'
ORDER BY fp_id &quot;);
while ($brow = sed_sql_fetcharray($sqlr))
{
	$brow&#091;'fp_text'&#093; = htmlspecialchars($brow&#091;'fp_text'&#093;);
	$brow&#091;'fp_created'&#093; = @date($cfg&#091;'dateformat'&#093;, $brow&#091;'fp_creation'&#093; + $usr&#091;'timezone'&#093; * 3600);
	$brow&#091;'fp_updated_ago'&#093; = sed_build_timegap($brow&#091;'fp_updated'&#093;, $sys&#091;'now_offset'&#093;);
	$brow&#091;'fp_updated'&#093; = @date($cfg&#091;'dateformat'&#093;, $brow&#091;'fp_updated'&#093; + $usr&#091;'timezone'&#093; * 3600);
	$brow&#091;'user_text'&#093; = ($fs_allowusertext) ? $brow&#091;'user_text'&#093; : '';
	$lastposterid = $brow&#091;'fp_posterid'&#093;;
	$lastposterip = $brow&#091;'fp_posterip'&#093;;
	$fp_num++;
	$i = empty($id) ? $d + $fp_num : $id;

	$browquote  = ($usr&#091;'id'&#093;&gt;0) ? &quot;&lt;a href=https://www.cotonti.com/\&quot;&quot;.sed_url('forums', &quot;m=posts&amp;s=&quot;.$s.&quot;&amp;q=&quot;.$q.&quot;&amp;quote=&quot;.$brow&#091;'fp_id'&#093;.&quot;&amp;n=last&quot;, &quot;#np&quot;).&quot;\&quot;&gt;&quot;.$L&#091;'Quote'&#093;.&quot;&lt;/a&gt;&quot; : &quot;&amp;nbsp;&quot;;
	$browedit   = (($usr&#091;'isadmin'&#093; || $brow&#091;'fp_posterid'&#093;==$usr&#091;'id'&#093;) &amp;&amp; $usr&#091;'id'&#093;&gt;0) ? &quot;&lt;a href=https://www.cotonti.com/\&quot;&quot;.sed_url('forums', &quot;m=editpost&amp;s=&quot;.$s.&quot;&amp;q=&quot;.$q.&quot;&amp;p=&quot;.$brow&#091;'fp_id'&#093;.&quot;&amp;&quot;.sed_xg()).&quot;\&quot;&gt;&quot;.$L&#091;'Edit'&#093;.&quot;&lt;/a&gt;&quot; : '';
	$browdelete = ($usr&#091;'id'&#093;&gt;0 &amp;&amp; ($usr&#091;'isadmin'&#093; || $brow&#091;'fp_posterid'&#093;==$usr&#091;'id'&#093;) &amp;&amp; !($post12&#091;0&#093;==$brow&#091;'fp_id'&#093; &amp;&amp; $post12&#091;1&#093;&gt;0)) ? $L&#091;'Delete'&#093;.&quot;:&#091;&lt;a href=https://www.cotonti.com/\&quot;&quot;.sed_url('forums', &quot;m=posts&amp;a=delete&amp;&quot;.sed_xg().&quot;&amp;s=&quot;.$s.&quot;&amp;q=&quot;.$q.&quot;&amp;p=&quot;.$brow&#091;'fp_id'&#093;).&quot;\&quot;&gt;x&lt;/a&gt;&#093;&quot; : '';
	$browdelete .= ($fp_num==$totalposts) ? &quot;&lt;a name=\&quot;bottom\&quot; id=\&quot;bottom\&quot;&gt;&lt;/a&gt;&quot; : '';
        $sadminoptions = $browquote.' &amp;nbsp; '.$browedit.' &amp;nbsp; '.$browdelete;

	if ($usr&#091;'id'&#093;&gt;0 &amp;&amp; $n=='unread' &amp;&amp; !$unread_done &amp;&amp; $brow&#091;'fp_creation'&#093;&gt;$usr&#091;'lastvisit'&#093;)
	{
		$unread_done = TRUE;
		$adminoptions .= &quot;&lt;a name=\&quot;unread\&quot; id=\&quot;unread\&quot;&gt;&lt;/a&gt;&quot;;
	}

	$brow&#091;'fp_posterip'&#093; = ($usr&#091;'isadmin'&#093;) ? sed_build_ipsearch($brow&#091;'fp_posterip'&#093;) : '';

        if($cfg&#091;'parser_cache'&#093;)
	{
		if(empty($brow&#091;'fp_html'&#093;) &amp;&amp; !empty($brow&#091;'fp_text'&#093;))
		{
			$brow&#091;'fp_html'&#093; = sed_parse($brow&#091;'fp_text'&#093;, $cfg&#091;'parsebbcodeforums'&#093;  &amp;&amp; $fs_allowbbcodes, $cfg&#091;'parsesmiliesforums'&#093;  &amp;&amp; $fs_allowsmilies, 1);
			sed_sql_query(&quot;UPDATE $db_forum_posts SET fp_html = '&quot;.sed_sql_prep($brow&#091;'fp_html'&#093;).&quot;' WHERE fp_id = &quot; . $row&#091;'fp_id'&#093;);
		}
		$brow&#091;'fp_text'&#093; = sed_post_parse($brow&#091;'fp_html'&#093;, 'forums');
	}
	else
	{
		$brow&#091;'fp_text'&#093; = sed_parse($brow&#091;'fp_text'&#093;, ($cfg&#091;'parsebbcodeforums'&#093; &amp;&amp; $fs_allowbbcodes), ($cfg&#091;'parsesmiliesforums'&#093; &amp;&amp; $fs_allowsmilies), 1);
		$brow&#091;'fp_text'&#093; = sed_post_parse($brow&#091;'fp_text'&#093;, 'forums');
	}
	$brow&#091;'fp_useronline'&#093; = (sed_userisonline($brow&#091;'fp_posterid'&#093;)) ? &quot;1&quot; : &quot;0&quot;;
	$brow&#091;'fp_useronlinetitle'&#093; = ($brow&#091;'fp_useronline'&#093;) ? $skinlang&#091;'forumspost'&#093;&#091;'Onlinestatus1'&#093; : $skinlang&#091;'forumspost'&#093;&#091;'Onlinestatus0'&#093;;

	if (!empty($row&#091;'fp_updater'&#093;))
	{ $brow&#091;'fp_updatedby'&#093; = sprintf($L&#091;'for_updatedby'&#093;, htmlspecialchars($brow&#091;'fp_updater'&#093;), $brow&#091;'fp_updated'&#093;, $brow&#091;'fp_updated_ago'&#093;); }


		$brow&#091;'user_birthdate'&#093; = sed_date2stamp($brow&#091;'user_birthdate'&#093;);
		$brow&#091;'user_text'&#093; = sed_build_usertext($brow&#091;'user_text'&#093;);
		$brow&#091;'user_age'&#093; = ($brow&#091;'user_birthdate'&#093;!=0) ? sed_build_age($brow&#091;'user_birthdate'&#093;) : '';

	$t-&gt; assign(array(
		&quot;FORUMS_POSTS_STICK_ID&quot; =&gt; $brow&#091;'fp_id'&#093;,
		&quot;FORUMS_POSTS_STICK_POSTID&quot; =&gt; 'post_'.$brow&#091;'fp_id'&#093;,
		&quot;FORUMS_POSTS_STICK_IDURL&quot; =&gt; sed_url('forums', &quot;m=posts&amp;id=&quot;.$brow&#091;'fp_id'&#093;),
		&quot;FORUMS_POSTS_STICK_URL&quot; =&gt; sed_url('forums', &quot;m=posts&amp;p=&quot;.$brow&#091;'fp_id'&#093;, &quot;#&quot;.$brow&#091;'fp_id'&#093;),
		&quot;FORUMS_POSTS_STICK_CREATION&quot; =&gt; $brow&#091;'fp_created'&#093;,
		&quot;FORUMS_POSTS_STICK_UPDATED&quot; =&gt; $brow&#091;'fp_updated'&#093;,
		&quot;FORUMS_POSTS_STICK_UPDATER&quot; =&gt; htmlspecialchars($brow&#091;'fp_updater'&#093;),
		&quot;FORUMS_POSTS_STICK_UPDATEDBY&quot; =&gt; $brow&#091;'fp_updatedby'&#093;,
		&quot;FORUMS_POSTS_STICK_TEXT&quot; =&gt; $brow&#091;'fp_text'&#093;,
		&quot;FORUMS_POSTS_STICK_POSTERNAME&quot; =&gt; sed_build_user($brow&#091;'fp_posterid'&#093;, htmlspecialchars($brow&#091;'fp_postername'&#093;)),
		&quot;FORUMS_POSTS_STICK_POSTERID&quot; =&gt; $brow&#091;'fp_posterid'&#093;,
		&quot;FORUMS_POSTS_STICK_MAINGRP&quot; =&gt; sed_build_group($brow&#091;'user_maingrp'&#093;),
		&quot;FORUMS_POSTS_STICK_MAINGRPID&quot; =&gt; $brow&#091;'user_maingrp'&#093;,
		&quot;FORUMS_POSTS_STICK_MAINGRPSTARS&quot; =&gt; sed_build_stars($sed_groups&#091;$brow&#091;'user_maingrp'&#093;&#093;&#091;'level'&#093;),
		&quot;FORUMS_POSTS_STICK_MAINGRPICON&quot; =&gt; sed_build_userimage($sed_groups&#091;$brow&#091;'user_maingrp'&#093;&#093;&#091;'icon'&#093;),
		&quot;FORUMS_POSTS_STICK_USERTEXT&quot; =&gt; $brow&#091;'user_text'&#093;,
		&quot;FORUMS_POSTS_STICK_AVATAR&quot; =&gt; sed_build_userimage($brow&#091;'user_avatar'&#093;, 'avatar'),
		&quot;FORUMS_POSTS_STICK_PHOTO&quot; =&gt; sed_build_userimage($brow&#091;'user_photo'&#093;, 'photo'),
		&quot;FORUMS_POSTS_STICK_SIGNATURE&quot; =&gt; sed_build_userimage($brow&#091;'user_signature'&#093;, 'sig'),
		&quot;FORUMS_POSTS_STICK_GENDER&quot; =&gt; $brow&#091;'user_gender'&#093; = ($row&#091;'user_gender'&#093;=='' || $brow&#091;'user_gender'&#093;=='U') ? '' : $L&#091;&quot;Gender_&quot;.$row&#091;'user_gender'&#093;&#093;,
		&quot;FORUMS_POSTS_STICK_POSTERIP&quot; =&gt; $brow&#091;'fp_posterip'&#093;,
		&quot;FORUMS_POSTS_STICK_USERONLINE&quot; =&gt; $brow&#091;'fp_useronline'&#093;,
		&quot;FORUMS_POSTS_STICK_USERONLINETITLE&quot; =&gt; $brow&#091;'fp_useronlinetitle'&#093;,
                &quot;FORUMS_POSTS_STICK_DELETE&quot; =&gt; $rowdelete,
                &quot;FORUMS_POSTS_STICK_EDIT&quot; =&gt; $rowedit,
                &quot;FORUMS_POSTS_STICK_QUOTE&quot; =&gt; $rowquote,
		&quot;FORUMS_POSTS_STICK_ADMIN&quot; =&gt; $adminoptions,
		&quot;FORUMS_POSTS_STICK_COUNTRY&quot; =&gt; $sed_countries&#091;$brow&#091;'user_country'&#093;&#093;,
		&quot;FORUMS_POSTS_STICK_COUNTRYFLAG&quot; =&gt; sed_build_flag($brow&#091;'user_country'&#093;),
		&quot;FORUMS_POSTS_STICK_WEBSITE&quot; =&gt; sed_build_url($brow&#091;'user_website'&#093;, 36),
		&quot;FORUMS_POSTS_STICK_WEBSITERAW&quot; =&gt; $brow&#091;'user_website'&#093;,
		&quot;FORUMS_POSTS_STICK_EMAIL&quot; =&gt; sed_build_email($brow&#091;'user_email'&#093;, $brow&#091;'user_hideemail'&#093;),
		&quot;FORUMS_POSTS_STICK_LOCATION&quot; =&gt; htmlspecialchars($brow&#091;'user_location'&#093;),
		&quot;FORUMS_POSTS_STICK_OCCUPATION&quot; =&gt; htmlspecialchars($brow&#091;'user_occupation'&#093;),
		&quot;FORUMS_POSTS_STICK_AGE&quot; =&gt; $brow&#091;'user_age'&#093;,
		&quot;FORUMS_POSTS_STICK_POSTCOUNT&quot; =&gt; $brow&#091;'user_postcount'&#093;,
	));

	$t-&gt;parse(&quot;MAIN.FORUMS_POSTS_STICKER&quot;);
}</pre></div></div>
<br />
and for convinience - edit the main sql_select,so it wouldn't show the posts with mark Sticky:<br />
<pre class="code">	$sql = sed_sql_query(&quot;SELECT p.*, u.user_text, u.user_maingrp, u.user_avatar, u.user_photo, u.user_signature,
	$user_extrafields
	u.user_country, u.user_occupation, u.user_location, u.user_website, u.user_email, u.user_hideemail, u.user_gender, u.user_birthdate,
	u.user_postcount
	FROM $db_forum_posts AS p LEFT JOIN $db_users AS u ON u.user_id=p.fp_posterid
	WHERE   fp_topicid='$q'
	AND p.fs_poststicker = '0'
	ORDER BY fp_id LIMIT $d, &quot;.$cfg&#091;'maxpostsperpage'&#093;);</pre>
<br />
<em>After all of this add :</em><br />
<br />
<span style="text-decoration:underline">in forum.posts.tpl</span> <br />
<pre class="code">&lt;!-- BEGIN: FORUMS_POSTS_STICKER --&gt;
     {FORUMS_POSTS_STICK_TEXT} (use the same tags as in original post,but with _STICK_ )
&lt;!-- END: FORUMS_POSTS_STICKER --&gt;</pre>
<br />
<span style="text-decoration:underline">in forum.newtopic.tpl</span><br />
<pre class="code"> &lt;!-- BEGIN: STICKY --&gt;
     {STICKY_POST}
     &lt;!-- END: STICKY --&gt;
</pre>
<br />
<span style="text-decoration:underline">and in forum.editpost.tpl </span><br />
<pre class="code">
&lt;!-- BEGIN: STICKY --&gt;
     {STICKY_POST}
&lt;!-- END: STICKY --&gt;
</pre>]]></description>
			<pubDate>Пт, 20 Лис 2009 00:44:56 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/ua/forums?m=posts&q=4978&d=0#post21065]]></link>
		</item>
	</channel>
</rss>