1
Intuit
My first attempts at writing a module from scratch
  • 2005/8/30 19:51

  • Intuit

  • Just popping in

  • Posts: 60

  • Since: 2005/8/2 1


I have delayed beginning my own module creation as I am new to Xoops, PHP, AND smarty, but I simply can't find all the modules I need, so I have no choice.

I am now testing with a simple module that will do nothing but allow users to make entries to sort of a blog. The table will have only three fields, username, date, and text.

Things are ok so far, EXCEPT, whenever the front page of the module is loaded, the user gets logged out! Anyone know any common reasons for this? I can post the code(short) if needed.
--
I
http://www.articles4business.com - post your small business/financial/internet biz articles here to promote your site!
http://www.seductionhome.com

2
adrock
Re: My first attempts at writing a module from scratch
  • 2005/8/30 19:58

  • adrock

  • Quite a regular

  • Posts: 291

  • Since: 2004/12/7


your module is not setting the session info for the user...so when it loads, it doesn't see the user as being actively logged in....

newbb does it like this for posting....

Quote:

if(empty($_SESSION['submit_token']) || $_POST['post_valid']!=$_SESSION['submit_token']) {
if($topic_id){
$redirect = "viewtopic.php?topic_id=".$topic_id."&start=".$start;
if($post_id) $redirect .="#forumpost".$post_id."";
}else{
$redirect = "viewforum.php?forum=".$forum;
}


Happy Xoopsing!
Affordable Web Hosting - Family - Fun!...and not always in that order!

3
Dave_L
Re: My first attempts at writing a module from scratch
  • 2005/8/30 20:08

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Shouldn't that be handled automatically, as long as you're including mainfile.php?

require_once '../../mainfile.php';

4
adrock
Re: My first attempts at writing a module from scratch
  • 2005/8/30 20:12

  • adrock

  • Quite a regular

  • Posts: 291

  • Since: 2004/12/7


hehe... you would know more than I would Dave!

I assumed that he has included the mainfile include statement in his index.php as that is one of the first things discussed in the 'how to's' of making your own modules!
Affordable Web Hosting - Family - Fun!...and not always in that order!

5
Dave_L
Re: My first attempts at writing a module from scratch
  • 2005/8/30 20:22

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7




mainfile.php includes include/common.php, which has a section for taking care of the session/login stuff.

In my modules, all I've had to do is include mainfile.php, and the current user remains logged in.

6
Intuit
Re: My first attempts at writing a module from scratch
  • 2005/8/30 20:23

  • Intuit

  • Just popping in

  • Posts: 60

  • Since: 2005/8/2 1


Figured it out....

Here were my includes:

require_once "../../mainfile.php";
// include "../../include/common.php";
include "../../header.php";

I got rid of the common.php, now it works...I forgot why I was including it in the first place. Blame it on trial and error...Thanks
--
I
http://www.articles4business.com - post your small business/financial/internet biz articles here to promote your site!
http://www.seductionhome.com

Login

Who's Online

266 user(s) are online (162 user(s) are browsing Support Forums)


Members: 0


Guests: 266


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits