1
nightr
Is it possible with xoops?
  • 2004/9/3 9:33

  • nightr

  • Just popping in

  • Posts: 14

  • Since: 2003/5/28


Hi!
I'm installed XOOPS and i need to do 2 things:
1. When I create news with the included news module, i can divide the news article in 2 parts with option. Can I make somehow, that only registered users could read the full story and anonymous could read only the short version (that is before tag)
2. Is it possible with some sort of script to take a part of remote webpage's source and paste it into the one that is loading (the one where this script is). For example the script searches for specific tagline and copies everything untill another tagline specifieed by me.
I hope i made myself clear

2
Mithrandir
Re: Is it possible with xoops?

1. There is no tag - there is a link to the full story saying "read more"

You can put
if (!$xoopsUser) {
    
redirect_header('index.php'2_NOPERM);
}

in the top of article.php (below the inclusion of mainfile.php)

this will prevent non-regged users from accessing that page at all.

Alternatively, you can go in the code for the article display and do the same condition and set "bodytext" to nothing if the user is not logged in. This procedure will be a little different depending on the version of your News module.

3
nightr
Re: Is it possible with xoops?
  • 2004/9/3 9:50

  • nightr

  • Just popping in

  • Posts: 14

  • Since: 2003/5/28


i'm using the XOOPS 2.0 built in news module.
Quote:

if (!$xoopsUser) {
redirect_header('index.php', 2, _NOPERM);
}

Is $xoopsUser something static or should i change it to anynomous? Excuse the question but i'm a 0 in php

Quote:

Alternatively, you can go in the code for the article display and do the same condition and set "bodytext" to nothing if the user is not logged in

Could you be so kind and tell me how to do that?

4
Mithrandir
Re: Is it possible with xoops?

If a user is logged in, $xoopsUser will be a XoopsUser object. If he is not, the object will be null. Therefore the test
if (!$xoopsUser)

(note the exclamation mark before the variable) will return true as it asks "IF the $xoopsUser variable does NOT hold a value (or a value equal to zero) THEN do this"

The second approach is a bit more complicated (especially to an unskilled PHP programmer) and has changed from News 1.0 (the one shipped with the XOOPS package) to News 1.2 version. I don't have a copy of the 1.0 version with me, so I wouldn't be able to say exactly where to put the code.

5
nightr
Re: Is it possible with xoops?
  • 2004/9/3 10:11

  • nightr

  • Just popping in

  • Posts: 14

  • Since: 2003/5/28


thanx a lot! :)
P.S. maybe you could tell me, is my second task (from my first post) solvable? Is it possible with XOOPS or with php at all?

6
Mithrandir
Re: Is it possible with xoops?

Yes it's possible. Using fopen (PHP function) or Snoopy (3rd party class included in XOOPS) it should be possible to load another page and manipulate with it before displaying it.

Not my field of expertise, though.

7
nightr
Re: Is it possible with xoops?
  • 2004/9/3 11:51

  • nightr

  • Just popping in

  • Posts: 14

  • Since: 2003/5/28


DUDE THANX! I LOVE YOU!
The helping and reacting rate on this forum is amazing!!!

8
nightr
Re: Is it possible with xoops?
  • 2004/9/7 12:32

  • nightr

  • Just popping in

  • Posts: 14

  • Since: 2003/5/28


by the way, when i added
Quote:

if (!$xoopsUser) {
redirect_header('index.php', 2, _NOPERM);echo "akaka";
}

to article.php, and try to view it being logged in as administrator, i see a blank page. Why is that?

Login

Who's Online

345 user(s) are online (121 user(s) are browsing Support Forums)


Members: 0


Guests: 345


more...

Donat-O-Meter

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

Latest GitHub Commits