- Posts: 27
- Thank you received: 0
Kunena 7.0.4 Released
The Kunena team has announce the arrival of Kunena 7.0.4 [K 7.0.4] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0
This category contains miscellaneous, uncategorised user contributions, (templates, modules, plugins and hacks) relating to older versions of Kunena that are no longer supported.
This category may also contain a few topics relating to K 1.6 that may have been moved here possibly by mistake.
The topics in this category are for historical interest only. Owing to the structural differences between K 1.6 and K 1.7, these ideas in these topics will not work with later versions and, for that reason, the topics are locked.
This category may also contain a few topics relating to K 1.6 that may have been moved here possibly by mistake.
The topics in this category are for historical interest only. Owing to the structural differences between K 1.6 and K 1.7, these ideas in these topics will not work with later versions and, for that reason, the topics are locked.
Question I wrote a user suspension hack
- dougthonus
-
Topic Author
- Offline
- Junior Member
-
Less
More
17 years 1 month ago - 17 years 1 month ago #10307
by dougthonus
I wrote a user suspension hack was created by dougthonus
kunena changes:
(you must also create the suspend.gif picture)
There's a lot to add, so I wouldn't screw with your files if you don't know what you're doing. If the admins are interested, I'll add more features. This allows you to suspend users, but doesn't have a complete view for seeing past suspensions or present suspensions or change user titles or have it show up on profiles and all that stuff.
I'm not going to spend the time adding that unless the admins are going to include it in the new version, since this does the bare minimum of what I need, I'm not going to fancy it up for others unless it's going to get real use.
SQL
CREATE TABLE IF NOT EXISTS `jos_fb_suspended` (
`id` int(11) NOT NULL auto_increment,
`userid` int(11) NOT NULL,
`suspension_date` datetime NOT NULL,
`comment` text NOT NULL,
`suspended_by` int(11) NOT NULL,
PRIMARY KEY (`id`)
);
components\com_kunena\template\default\icons.php line 42 added:
$fbIcons = 'suspend.gif';
administrator\components\com_kunena\language\kunena.english.php line 155 added:
DEFINE('_GEN_SUSPEND', 'Suspend');
DEFINE('_POST_SUSPEND_DAYS','Days to suspend');
DEFINE('_POST_SUSPEND_REASON','Reason for suspension');
components\com_kunena\lib\kunena.ink.class.php line 238 added:
function GetSuspendLink($do, $catid, $id, $userid, $name, $rel='nofollow')
{
return CKunenaLink::GetSefHrefLink(KUNENA_LIVEURLREL.'&func=post&do='.$do.'&catid='.$catid.'&id='.$id.'&suserid='.$userid, $name, '', $rel);
}
components\com_kunena\template\default\view.php line 1026 added:
components\com_kunena\template\default_ex\view.php line 1123 added:
$msg_suspend = CKunenaLink::GetTopicPostLink('suspend', $catid, $fmessage->userid, $fbIcons?'<img src="' . KUNENA_URLICONSPATH . $fbIcons . '" alt="' . _GEN_SUSPEND . '" border="0" title="' . _GEN_SUSPEND . '" />':_GEN_SUSPEND);
components\com_kunena\template\default\post.php line 1760 added:
if ($userid != 0) {
//check to see if user is suspended
$query = "select userid, suspension_date, comment from #__fb_suspended where userid=$userid && suspension_date > NOW()";
$database->setQuery($query);
$database->query();
$database->loadObject($objSuspended);
if($objSuspended->userid > 0) {
$suspended = 1;
}
}
(same file line 1778 (though depending carriage returns your line number may vary, after the comment //user is not allowed to write a post)
if ($suspended)
{
echo "<p align=\"center\">Your account has been suspended until " .$objSuspended->suspension_date ." <br/>Reason given: " .$objSuspended->comment ."<br.></p>";
}
else if ($topicLock)
(else if($topicLock) replaces if($topicLock)
components\com_kunena\template\default_ex\message.php line 356 add
components\com_kunena\template\default\message.php line 393 add
if ($msg_suspend) {
echo " " . $msg_suspend;
}
components\com_kunena\template\default\post.php
//suspension form
else if ($do == "suspend")
{
if (!$is_Moderator)
{
mosRedirect(htmlspecialchars_decode(sefRelToAbs(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR);
}
$suserid = mosGetParam($_REQUEST, "suserid", null);
$database->setQuery("SELECT a.*,b.name,b.username,b.gid FROM #__fb_users as a LEFT JOIN #__users as b on b.id=a.userid where a.userid='$suserid'");
$database->loadObject($userinfo);
//get the username:
$suspend_username = "";
if ($fbConfig->username) {
$suspend_username = $userinfo->username;
}
else {
$suspend_username = $userinfo->name;
}
?>
<form action = "<?php echo sefRelToAbs(KUNENA_LIVEURLREL."&func=post"); ?>" method = "post" name = "myform">
<input type = "hidden" name = "do" value = "dosuspend"/>
<input type = "hidden" name = "catid" value = "<?php echo $catid;?>"/>
<input type = "hidden" name = "id" value = "<?php echo $id;?>"/>
<input type = "hidden" name = "suserid" value = "<?php echo $suserid;?>"/>
<p>
<strong><?php echo _GEN_SUSPEND . ' ' . $suspend_username; ?><br/><br/></strong>
<span title="<?php echo _POST_SUSPEND_DAYS; ?>"><?php echo _POST_SUSPEND_DAYS; ?>: <input type = "text" name = "days"></span><br/><br/>
<span title="<?php echo _POST_SUSPEND_REASON; ?>"><?php echo _POST_SUSPEND_REASON; ?>: <input type = "text" name = "reason"></span><br/>
<input type = "submit" class = "button" value = "<?php echo _GEN_SUSPEND;?>"/></p>
</form><?php
}
//insert suspension into database
else if ($do == "dosuspend")
{
if (!$is_Moderator)
{
mosRedirect(htmlspecialchars_decode(sefRelToAbs(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR);
}
$suserid = mosGetParam($_REQUEST, "suserid", null);
$reason = mosGetParam($_REQUEST, "reason", null);
$query = "insert into #__fb_suspended(userid,suspension_date,comment,suspended_by) values ($suserid,DATE_ADD(NOW(),INTERVAL 3 DAY),'$reason',".$my->id.")";
$database->setQuery($query);
$database->query();
echo '<br /><br /><div align="center">' . _POST_SUSPEND_SUCCESSFUL . "</div><br />";
echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $id, $fbConfig->messages_per_page);
}
(you must also create the suspend.gif picture)
There's a lot to add, so I wouldn't screw with your files if you don't know what you're doing. If the admins are interested, I'll add more features. This allows you to suspend users, but doesn't have a complete view for seeing past suspensions or present suspensions or change user titles or have it show up on profiles and all that stuff.
I'm not going to spend the time adding that unless the admins are going to include it in the new version, since this does the bare minimum of what I need, I'm not going to fancy it up for others unless it's going to get real use.
SQL
CREATE TABLE IF NOT EXISTS `jos_fb_suspended` (
`id` int(11) NOT NULL auto_increment,
`userid` int(11) NOT NULL,
`suspension_date` datetime NOT NULL,
`comment` text NOT NULL,
`suspended_by` int(11) NOT NULL,
PRIMARY KEY (`id`)
);
components\com_kunena\template\default\icons.php line 42 added:
$fbIcons = 'suspend.gif';
administrator\components\com_kunena\language\kunena.english.php line 155 added:
DEFINE('_GEN_SUSPEND', 'Suspend');
DEFINE('_POST_SUSPEND_DAYS','Days to suspend');
DEFINE('_POST_SUSPEND_REASON','Reason for suspension');
components\com_kunena\lib\kunena.ink.class.php line 238 added:
function GetSuspendLink($do, $catid, $id, $userid, $name, $rel='nofollow')
{
return CKunenaLink::GetSefHrefLink(KUNENA_LIVEURLREL.'&func=post&do='.$do.'&catid='.$catid.'&id='.$id.'&suserid='.$userid, $name, '', $rel);
}
components\com_kunena\template\default\view.php line 1026 added:
components\com_kunena\template\default_ex\view.php line 1123 added:
$msg_suspend = CKunenaLink::GetTopicPostLink('suspend', $catid, $fmessage->userid, $fbIcons?'<img src="' . KUNENA_URLICONSPATH . $fbIcons . '" alt="' . _GEN_SUSPEND . '" border="0" title="' . _GEN_SUSPEND . '" />':_GEN_SUSPEND);
components\com_kunena\template\default\post.php line 1760 added:
if ($userid != 0) {
//check to see if user is suspended
$query = "select userid, suspension_date, comment from #__fb_suspended where userid=$userid && suspension_date > NOW()";
$database->setQuery($query);
$database->query();
$database->loadObject($objSuspended);
if($objSuspended->userid > 0) {
$suspended = 1;
}
}
(same file line 1778 (though depending carriage returns your line number may vary, after the comment //user is not allowed to write a post)
if ($suspended)
{
echo "<p align=\"center\">Your account has been suspended until " .$objSuspended->suspension_date ." <br/>Reason given: " .$objSuspended->comment ."<br.></p>";
}
else if ($topicLock)
(else if($topicLock) replaces if($topicLock)
components\com_kunena\template\default_ex\message.php line 356 add
components\com_kunena\template\default\message.php line 393 add
if ($msg_suspend) {
echo " " . $msg_suspend;
}
components\com_kunena\template\default\post.php
//suspension form
else if ($do == "suspend")
{
if (!$is_Moderator)
{
mosRedirect(htmlspecialchars_decode(sefRelToAbs(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR);
}
$suserid = mosGetParam($_REQUEST, "suserid", null);
$database->setQuery("SELECT a.*,b.name,b.username,b.gid FROM #__fb_users as a LEFT JOIN #__users as b on b.id=a.userid where a.userid='$suserid'");
$database->loadObject($userinfo);
//get the username:
$suspend_username = "";
if ($fbConfig->username) {
$suspend_username = $userinfo->username;
}
else {
$suspend_username = $userinfo->name;
}
?>
<form action = "<?php echo sefRelToAbs(KUNENA_LIVEURLREL."&func=post"); ?>" method = "post" name = "myform">
<input type = "hidden" name = "do" value = "dosuspend"/>
<input type = "hidden" name = "catid" value = "<?php echo $catid;?>"/>
<input type = "hidden" name = "id" value = "<?php echo $id;?>"/>
<input type = "hidden" name = "suserid" value = "<?php echo $suserid;?>"/>
<p>
<strong><?php echo _GEN_SUSPEND . ' ' . $suspend_username; ?><br/><br/></strong>
<span title="<?php echo _POST_SUSPEND_DAYS; ?>"><?php echo _POST_SUSPEND_DAYS; ?>: <input type = "text" name = "days"></span><br/><br/>
<span title="<?php echo _POST_SUSPEND_REASON; ?>"><?php echo _POST_SUSPEND_REASON; ?>: <input type = "text" name = "reason"></span><br/>
<input type = "submit" class = "button" value = "<?php echo _GEN_SUSPEND;?>"/></p>
</form><?php
}
//insert suspension into database
else if ($do == "dosuspend")
{
if (!$is_Moderator)
{
mosRedirect(htmlspecialchars_decode(sefRelToAbs(KUNENA_LIVEURLREL)), _POST_NOT_MODERATOR);
}
$suserid = mosGetParam($_REQUEST, "suserid", null);
$reason = mosGetParam($_REQUEST, "reason", null);
$query = "insert into #__fb_suspended(userid,suspension_date,comment,suspended_by) values ($suserid,DATE_ADD(NOW(),INTERVAL 3 DAY),'$reason',".$my->id.")";
$database->setQuery($query);
$database->query();
echo '<br /><br /><div align="center">' . _POST_SUSPEND_SUCCESSFUL . "</div><br />";
echo CKunenaLink::GetLatestPostAutoRedirectHTML($fbConfig, $id, $fbConfig->messages_per_page);
}
Last edit: 17 years 1 month ago by dougthonus.
Please Log in or Create an account to join the conversation.
17 years 1 month ago #10310
by taurgis
Replied by taurgis on topic Re:I wrote a user suspension hack
This would be great if it was implemented in the version comming out this week or after. This is something Kunena needs!
Thanks for this excellent job.
Thanks for this excellent job.
Please Log in or Create an account to join the conversation.
17 years 4 weeks ago #10485
by taurgis
Replied by taurgis on topic Re:I wrote a user suspension hack
I find it weird no one is interested in this
Please Log in or Create an account to join the conversation.
- dougthonus
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 27
- Thank you received: 0
17 years 4 weeks ago #10487
by dougthonus
Replied by dougthonus on topic Re:I wrote a user suspension hack
Me too, I'm hoping that admins are just too busy to look at it with the impending release of 1.5 native tomorrow. That's a huge thing for them to do, so I can see why taking a look at this isn't a priority.
I wouldn't mind coding up a legit suspension front end (this just has a suspend button and a simple (ugly) form that allows you to select how many days they are suspended for. It also only prevents writing not reading.
Still, I'd think that functionality would be extremely valuable for many people as a last ditch effort. To make things really nice, it'd be good to have a suspend by IP functionality in there, but I don't know enough about joomla structures to know if the IP address was immediately handy in the function I was editing, and I didnt' want to rewrite too much without knowing what response it would get.
I wouldn't mind coding up a legit suspension front end (this just has a suspend button and a simple (ugly) form that allows you to select how many days they are suspended for. It also only prevents writing not reading.
Still, I'd think that functionality would be extremely valuable for many people as a last ditch effort. To make things really nice, it'd be good to have a suspend by IP functionality in there, but I don't know enough about joomla structures to know if the IP address was immediately handy in the function I was editing, and I didnt' want to rewrite too much without knowing what response it would get.
Please Log in or Create an account to join the conversation.
- johnnydement
-
- Offline
- Elite Member
-
Less
More
- Posts: 934
- Thank you received: 5
17 years 4 weeks ago #10489
by johnnydement
Replied by johnnydement on topic Re:I wrote a user suspension hack
I'm osrry, but user contributions have to be pretty well reviewd before making it to kunena. In fact not only those, but also the things done inside dev team, we want kunena to be pretty open, but we also want it to be a stable aplication. This is something that wasn't done with it's ancestor (somebody said moderation tools?
, and result we're badly written code and lots of bugs... (not saying this is the case with this hack)
For that is impossible a so recent hack can be reviewed, although we are pretty happy that someone spend his time in doing this
We are happy the community contributes to the code, but we have a clear roadmap and try to stick to it, that means that user contributions are reviewd when we're focusing on the issue they are about.
And yes, this next release is taking lots of times, basically because we want it to include a very tight CB integration, and everybody here and in joomlapolis is working against clock for it
For that is impossible a so recent hack can be reviewed, although we are pretty happy that someone spend his time in doing this
We are happy the community contributes to the code, but we have a clear roadmap and try to stick to it, that means that user contributions are reviewd when we're focusing on the issue they are about.
And yes, this next release is taking lots of times, basically because we want it to include a very tight CB integration, and everybody here and in joomlapolis is working against clock for it
Please Log in or Create an account to join the conversation.
- dougthonus
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 27
- Thank you received: 0
17 years 3 weeks ago - 17 years 3 weeks ago #10506
by dougthonus
Replied by dougthonus on topic Re:I wrote a user suspension hack
I would have been surprised if this was included at all in anything you released immediately, I was only surprised that it wasn't commented on.
I wrote it in the style and placement of the existing functional code. Anyway, I only spent an hour on it, so I figure if it's thrown away, then no big deal. I wouldn't mind writing a larger working suspension / comment system, but as I said, it's not worth it to me unless I knew it would be used.
I don't want to write it then have to try to rehack it every new release of the software, that'd be a big pain in the ass. Of course, I'm about to be buried in consulting work for the next 2 months, so who knows how much time I'll have anyway.
I wrote it in the style and placement of the existing functional code. Anyway, I only spent an hour on it, so I figure if it's thrown away, then no big deal. I wouldn't mind writing a larger working suspension / comment system, but as I said, it's not worth it to me unless I knew it would be used.
I don't want to write it then have to try to rehack it every new release of the software, that'd be a big pain in the ass. Of course, I'm about to be buried in consulting work for the next 2 months, so who knows how much time I'll have anyway.
Last edit: 17 years 3 weeks ago by dougthonus.
Please Log in or Create an account to join the conversation.
Time to create page: 0.285 seconds