#26 2015-02-03 18:54:38

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: Forum module

Tichu wrote:

any chance you can provide me your forum tables  sql dump which includes the triggers so i can just import into mine?

Here:

-- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Hoszt: localhost
-- Létrehozás ideje: 2015. Feb 03. 17:34
-- Szerver verzió: 5.5.41-0ubuntu0.14.04.1
-- PHP verzió: 5.5.9-1ubuntu4.5

SET FOREIGN_KEY_CHECKS=0;
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

--
-- Adatbázis: `ionize_107`
--

-- --------------------------------------------------------

--
-- Tábla szerkezet ehhez a táblához `forums`
--

DROP TABLE IF EXISTS `forums`;
CREATE TABLE IF NOT EXISTS `forums` (
  `id_forum` int(11) NOT NULL AUTO_INCREMENT,
  `order` int(11) NOT NULL,
  `parent` int(11) NOT NULL,
  `code` varchar(30) NOT NULL,
  `icon` varchar(100) NOT NULL DEFAULT 'folder',
  `locked` tinyint(1) NOT NULL DEFAULT '0',
  `level_read` double NOT NULL,
  `level_write` double NOT NULL,
  `level_moderator` double NOT NULL,
  `level_open` double NOT NULL,
  `num_topics` int(11) NOT NULL,
  `num_forums` int(11) NOT NULL DEFAULT '0',
  `last_date` datetime NOT NULL,
  `last_user` int(11) NOT NULL DEFAULT '0',
  `last_topic` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_forum`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- A tábla adatainak kiíratása `forums`
--

INSERT INTO `forums` (`id_forum`, `order`, `parent`, `code`, `icon`, `locked`, `level_read`, `level_write`, `level_moderator`, `level_open`, `num_topics`, `num_forums`, `last_date`, `last_user`, `last_topic`) VALUES
(1, 0, 0, '', '', 0, 10, 100, 1000, 100, 0, 0, '0000-00-00 00:00:00', 0, 0),
(2, 0, 1, '', 'folder', 0, 10, 100, 1000, 100, 2, 0, '2015-02-02 17:53:21', 1, 1);

-- --------------------------------------------------------

--
-- Tábla szerkezet ehhez a táblához `forums_lang`
--

DROP TABLE IF EXISTS `forums_lang`;
CREATE TABLE IF NOT EXISTS `forums_lang` (
  `lang_id` int(11) NOT NULL AUTO_INCREMENT,
  `id_forum` int(11) NOT NULL,
  `lang` varchar(100) NOT NULL,
  `url` varchar(100) NOT NULL,
  `title` varchar(100) NOT NULL,
  `description` text NOT NULL,
  `preview` text NOT NULL,
  PRIMARY KEY (`lang_id`),
  KEY `id_forum` (`id_forum`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- A tábla adatainak kiíratása `forums_lang`
--

INSERT INTO `forums_lang` (`lang_id`, `id_forum`, `lang`, `url`, `title`, `description`, `preview`) VALUES
(1, 1, 'en', 'first-forum', 'First forum', '', ''),
(2, 2, 'en', 'child-forum', 'Child forum', '', '');

-- --------------------------------------------------------

--
-- Tábla szerkezet ehhez a táblához `forum_attachments`
--

DROP TABLE IF EXISTS `forum_attachments`;
CREATE TABLE IF NOT EXISTS `forum_attachments` (
  `id_attach` int(11) NOT NULL AUTO_INCREMENT,
  `id_post` int(11) NOT NULL,
  `type` varchar(100) NOT NULL,
  `file` varchar(200) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id_attach`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tábla szerkezet ehhez a táblához `forum_posts`
--

DROP TABLE IF EXISTS `forum_posts`;
CREATE TABLE IF NOT EXISTS `forum_posts` (
  `id_post` int(11) NOT NULL AUTO_INCREMENT,
  `id_user` int(11) NOT NULL,
  `id_topic` int(11) NOT NULL,
  `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `content` text NOT NULL,
  `edited_by` int(11) NOT NULL,
  `edited_was` datetime NOT NULL,
  PRIMARY KEY (`id_post`),
  KEY `id_topic` (`id_topic`),
  KEY `id_user` (`id_user`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;

--
-- A tábla adatainak kiíratása `forum_posts`
--

INSERT INTO `forum_posts` (`id_post`, `id_user`, `id_topic`, `date`, `content`, `edited_by`, `edited_was`) VALUES
(1, 1, 1, '2015-02-02 16:35:16', '', 0, '0000-00-00 00:00:00'),
(2, 1, 2, '2015-02-02 16:35:30', 'asdasdasdasda', 0, '0000-00-00 00:00:00'),
(3, 1, 1, '2015-02-02 16:50:55', 'asdasdsa', 0, '0000-00-00 00:00:00'),
(4, 1, 1, '2015-02-02 16:53:21', 'asdasdasdas', 0, '0000-00-00 00:00:00');

--
-- Eseményindítók `forum_posts`
--
DROP TRIGGER IF EXISTS `forum_posts_after_insert`;
DELIMITER //
CREATE TRIGGER `forum_posts_after_insert` AFTER INSERT ON `forum_posts`
 FOR EACH ROW BEGIN

	               DECLARE $user_id, $topic_id, $forum_id, $num_posts, $num_topics INT;
	               DECLARE $last_date DATETIME;

	               SELECT id_topic, id_user, `date` FROM forum_posts ORDER BY id_post DESC
		               LIMIT 0,1 INTO $topic_id, $user_id, $last_date;

	               SELECT id_forum FROM forum_topics WHERE id_topic = $topic_id
		               INTO $forum_id;

	               SELECT COUNT(*) FROM forum_posts WHERE id_topic = $topic_id
		               INTO $num_posts;

	               UPDATE forum_topics
		               SET
			               last_user = $user_id,
			               last_date = $last_date,
			               num_posts = $num_posts

		               WHERE id_topic = $topic_id;

	               SELECT COUNT(*) FROM forum_topics WHERE id_forum = $forum_id
		               INTO $num_topics;

	               UPDATE forums
		               SET
			               last_user = $user_id,
			               last_date = $last_date,
			               last_topic = $topic_id,
			               num_topics = $num_topics

		               WHERE id_forum = $forum_id;


               END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Tábla szerkezet ehhez a táblához `forum_topics`
--

DROP TABLE IF EXISTS `forum_topics`;
CREATE TABLE IF NOT EXISTS `forum_topics` (
  `id_topic` int(11) NOT NULL AUTO_INCREMENT,
  `id_forum` int(11) NOT NULL,
  `order_level` int(11) NOT NULL,
  `topic_closed` tinyint(1) NOT NULL DEFAULT '0',
  `last_date` datetime NOT NULL,
  `last_user` int(11) NOT NULL,
  `num_read` int(11) NOT NULL,
  `num_posts` int(11) NOT NULL,
  `id_owner` int(11) NOT NULL,
  UNIQUE KEY `id_topic_3` (`id_topic`),
  KEY `id_topic` (`id_topic`),
  KEY `id_topic_2` (`id_topic`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- A tábla adatainak kiíratása `forum_topics`
--

INSERT INTO `forum_topics` (`id_topic`, `id_forum`, `order_level`, `topic_closed`, `last_date`, `last_user`, `num_read`, `num_posts`, `id_owner`) VALUES
(1, 2, 0, 0, '2015-02-02 17:53:21', 1, 0, 3, 1),
(2, 2, 0, 0, '0000-00-00 00:00:00', 1, 0, 0, 1);

--
-- Eseményindítók `forum_topics`
--
DROP TRIGGER IF EXISTS `forum_topics_after_insert`;
DELIMITER //
CREATE TRIGGER `forum_topics_after_insert` AFTER INSERT ON `forum_topics`
 FOR EACH ROW BEGIN

	            DECLARE $topic_id, $forum_id, $num_topic INT;
                
                SELECT id_forum FROM forum_topics ORDER BY id_topic DESC
		            LIMIT 0,1 INTO $forum_id;
		            
		         SELECT COUNT(*) FROM forum_topics WHERE id_forum = $forum_id INTO $num_topic;		         

	            UPDATE forums SET num_topics = $num_topic
		            WHERE id_forum = $forum_id;
               

            END
//
DELIMITER ;

-- --------------------------------------------------------

--
-- Tábla szerkezet ehhez a táblához `forum_topics_lang`
--

DROP TABLE IF EXISTS `forum_topics_lang`;
CREATE TABLE IF NOT EXISTS `forum_topics_lang` (
  `lang_id` int(11) NOT NULL AUTO_INCREMENT,
  `id_topic` int(11) NOT NULL,
  `lang` varchar(100) NOT NULL,
  `url` varchar(100) NOT NULL,
  `title` varchar(100) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`lang_id`),
  UNIQUE KEY `url` (`url`),
  KEY `id_topic` (`id_topic`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;

--
-- A tábla adatainak kiíratása `forum_topics_lang`
--

INSERT INTO `forum_topics_lang` (`lang_id`, `id_topic`, `lang`, `url`, `title`, `description`) VALUES
(1, 1, 'en', 'asdsadasdas', 'asdsadasdas', ''),
(2, 2, 'en', 'sadadasd', 'sadadasd', '');

-- --------------------------------------------------------

--
-- Tábla szerkezet ehhez a táblához `module_forum`
--

DROP TABLE IF EXISTS `module_forum`;
CREATE TABLE IF NOT EXISTS `module_forum` (
  `id_settings` int(11) NOT NULL AUTO_INCREMENT,
  `order` int(11) NOT NULL,
  `parent` int(11) NOT NULL,
  `type` varchar(100) NOT NULL,
  `name` varchar(200) NOT NULL,
  `value` text NOT NULL,
  `default` varchar(100) NOT NULL,
  `options` text NOT NULL,
  PRIMARY KEY (`id_settings`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
SET FOREIGN_KEY_CHECKS=1;

Last edited by adaliszk (2015-02-03 18:55:49)


Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

#27 2015-02-03 19:38:20

Tichu
Member
Registered: 2015-02-01
Posts: 21

Re: Forum module

thank you,

i ran the sql query from phpmyadmin and now it worked and added triggers.

so the forum works ok now.

looks good, great work :-)

i got a question:
when you add new topic and then someone else post a reply ,  the new replay shows in top of the original main topic post.

is there a way to show the replays below instead?

Last edited by Tichu (2015-02-03 19:44:11)

Offline

#28 2015-02-03 19:43:02

Tichu
Member
Registered: 2015-02-01
Posts: 21

Re: Forum module

also noticed the "edit" or "delete" or "quote" buttons do not work when in the topic post.

are they disabled or bug?

Offline

#29 2015-02-03 22:08:59

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: Forum module

Tichu wrote:

also noticed the "edit" or "delete" or "quote" buttons do not work when in the topic post.

are they disabled or bug?

I saw too,  it must be something which was with the base url, I will solve it soon.


Tichu wrote:

i got a question:
when you add new topic and then someone else post a reply ,  the new replay shows in top of the original main topic post.

is there a way to show the replays below instead?

Of corse,  in the module files you must change the forum_model.php the get posts method has an order by with DESC, change it to ASC. In the new version that will work with tag attribute.


Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

#30 2015-02-03 23:14:13

Tichu
Member
Registered: 2015-02-01
Posts: 21

Re: Forum module

$this->db->order_by('date', 'asc');

thanks,


ok, this is looking better and better

now, there are a couple request to make it simple yet enough to be used in live website,

features are:

- allow to "edit"  the post reply or topic by original user  and admin or moderator too

- "delete"  post or topic only allowed for admin or moderator.

- also to show topic  view count or reads or visits to know how many times topic has been viewed.

- to make option so each topic created the admin will need to authorize to prevent topic spamming.

- to click on user profile in the topic and display all post made by user.

- allow admin to edit topic to move topic to other forum category

- to allow admin ban a user to keep him off the forum or not allowing him to post.


is this a long list :-)

i can try to help if you want

Last edited by Tichu (2015-02-03 23:16:42)

Offline

#31 2015-02-04 01:04:35

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: Forum module

Oh and I forgott answer something:

Tichu wrote:

i got a question:
when you add new topic and then someone else post a reply ,  the new replay shows in top of the original main topic post.

is there a way to show the replays below instead?

Yes the reply is showing in the parent forum and topic view, it shows the last date and the last user and i the last updated topic name too.

Tichu wrote:

now, there are a couple request to make it simple yet enough to be used in live website, features are:

- allow to "edit"  the post reply or topic by original user  and admin or moderator too
- "delete"  post or topic only allowed for admin or moderator.
- allow admin to edit topic to move topic to other forum category

If you are higher level than level_moderator then you should can edit the topic and the posts too, and then you can delete it as well, at least that was worked before when i writed the module but now I don't know that I just wanted to develop that or I already done with it. In the example in the topic view you can edit and delete the posts, so the edit and delete should work.

Tichu wrote:

i can try to help if you want

You can always help if you can, I want to finish the next version and I don't want to fix the old versions problems smile
One thing will be extremely helpfull: creating the issues and feature requests on github: https://github.com/adamos42/io_forum/issues


Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

#32 2015-02-04 01:27:17

Tichu
Member
Registered: 2015-02-01
Posts: 21

Re: Forum module

adamos42 wrote:
Tichu wrote:

now, there are a couple request to make it simple yet enough to be used in live website, features are:

- allow to "edit"  the post reply or topic by original user  and admin or moderator too
- "delete"  post or topic only allowed for admin or moderator.
- allow admin to edit topic to move topic to other forum category

If you are higher level than level_moderator then you should can edit the topic and the posts too, and then you can delete it as well, at least that was worked before when i writed the module but now I don't know that I just wanted to develop that or I already done with it. In the example in the topic view you can edit and delete the posts, so the edit and delete should work.


well, i am doing this as superadmin and can not quote,edit or delete topics or posts.


i looked at the class Forum,class Forum_model,class Forum_Tags  and the example code from github wiki for the forum_index view

and did not find any code or functions for edit,delete, or quote a topic or post.  maybe you accidentaly removed it before?      :-(

only found code or function for forum edit,  but not topic or post.

maybe i missed it or did not look at the correct files,   can you tell me where to find it?

thank you again.

Last edited by Tichu (2015-02-04 01:30:42)

Offline

#33 2015-08-23 15:51:34

adaliszk
Ionize Friend
From: Germany
Registered: 2010-09-20
Posts: 397
Website

Re: Forum module

Tichu wrote:

well, i am doing this as superadmin and can not quote,edit or delete topics or posts.


i looked at the class Forum,class Forum_model,class Forum_Tags  and the example code from github wiki for the forum_index view

and did not find any code or functions for edit,delete, or quote a topic or post.  maybe you accidentaly removed it before?      :-(

only found code or function for forum edit,  but not topic or post.

maybe i missed it or did not look at the correct files,   can you tell me where to find it?

thank you again.

Sorry for the late answer, on the master branch you can edit only forum. On the development branch I will make that functions. I changed jobs a lot lately so a bit neglected the module, but now it looks like I have a steady job, so I have time to finish it.


Webdeveloper, Programmer, Application developer, Ionize friend
@adaliszk

Offline

What's Ionize ?

Ionize is an Open Source Content Management System created by webdesigners for webdesigners.

Created and maintained by Partikule and Toopixel, Ionize wants to be the easiest and most powerful CMS.

Can I help ?

Because talent is nothing without involvement, we are looking for motivated coders and webdesigners to join the project team.

Resources

Website : ionizecms.com
Documentation : doc.ionizecms.com

Development : Ionize on GitHub
Translations : Ionize Translations