[IPB,Nucleus/B:CMS] Tutorial How to integrate IP.Board to BLOG:CMS/Nucleus

ohubsch

New Member
Messages
3
Reaction score
0
Points
0
Hello dear comunity :)

My tutorial is about using CREATE VIEW and also CREATE TRIGGER for use one user acc in IP.Board and B:CMS/Nucleus. So it is first step to integrate IP.Board to those CMSs :). Next step will be link to that forum &
use TRIGGER for teams (for ex. you have an IP.Board forum, and you want to moderators can post items (articles) to your B:CMS/Nucleus site.)

B:CMS/Nucleus using for authorization only one table, nucleus_member. IP.Board for same using three tables, ipb_members (user name);ipb_members_extra (email); ipb_members_converge (password hash).
We have luck, because all B:CMS/Nucleus requirement is included in IPB tables also. So, we will DROP table member (BACKUP first if you have any data in this table!!!), and create VIEW to three ipb tables.

For ex that:
Code:
DROP TABLE `nucleus_member`;

CREATE VIEW `nucleus_member` AS 
SELECT 
	`m`.`id` AS `mnumber`,
	`m`.`name` AS `mname`,
	`m`.`members_display_name` AS `mrealname`,
	`m`.`email` AS `memail`,
	`e`.`website` AS `murl`,
	`e`.`notes` AS `mnotes`,
	`c`.`converge_pass_hash` AS `mpassword`,
	`c`.`converge_pass_salt` AS `mcookiehash`,
	`m`.`member_login_key` AS `mcookiekey`,
	`e`.`mcanlogin` AS `mcanlogin`,
	`e`.`deflang` AS `deflang`,
	`e`.`madmin` AS `madmin` 
FROM (
	(`ipb_members` `m` 
	JOIN `ipb_member_extra` `e` ON ((`m`.`id` = `e`.`id`))) 
	JOIN `ipb_members_converge` `c` ON 
		((`m`.`id` = `c`.`converge_id`)));


So that is our first step .. If you create acc in forum now, you have acc in B:CMS/Nucleus also.


In B:CMS/Nucleus there are table nucleus_team, what says, where user can send article / item.TRIGGER is action, what will be run, if you run query INSERT, UPDATE OR DELETE.

So in our example, we have group with moderators (mgroup=7), and we want users in this group can post articles / items.

TRIGGER:

Code:
CREATE TRIGGER `newmember_to_team` 
BEFORE UPDATE ON `ipb_members` 
FOR EACH ROW 
BEGIN
	IF (NEW.mgroup <> OLD.mgroup) THEN
		DELETE FROM team WHERE tmember = NEW.id;
		IF (NEW.mgroup=7) THEN
			INSERT INTO nucleus_team (tmember, tblog, tadmin) 
				VALUES (NEW.id, 24, 0);
		END IF;
	END IF;
END;

This trigger do:
If there are user in mgroup=7, we will write privileges to him,
so he is able to post new article/item. If not, it delete his privileges.
We must also create delete trigger:

Code:
 CREATE TRIGGER `delete_member_from_team` 
BEFORE DELETE ON `ipb_members` 
FOR EACH ROW 
BEGIN
	DELETE FROM team WHERE tmember = OLD.id;
END;

it is run, when you delete user from database.

I am glad if it help anyone user in this great community :).
 
Last edited:

zzurrien

New Member
Messages
45
Reaction score
0
Points
0
Thanks for guide :)
Can be helpful if I use IP.Board and B:CMS/Nucleus some day...
 
Top