1
Mantooth
(php) any help appreciated
  • 2005/4/1 0:34

  • Mantooth

  • Friend of XOOPS

  • Posts: 189

  • Since: 2004/11/2


I don't know anything about php and was wondering if someone could help me with this problem.

I would like members of my site to have a certain post count to be able to access my wf-downloads module. And if they don't have enough posts, they are redirected to a page that says "sorry, you need 10 posts to access this area".

Is there a relatively easy way to accomplish this perhaps by adding some code to the wf-downloads index page?

2
Mantooth
Re: (php) any help appreciated
  • 2005/4/3 18:34

  • Mantooth

  • Friend of XOOPS

  • Posts: 189

  • Since: 2004/11/2


?

3
Mantooth
Re: (php) any help appreciated
  • 2005/4/6 1:56

  • Mantooth

  • Friend of XOOPS

  • Posts: 189

  • Since: 2004/11/2


could i insert some code to the wf-downloads index page that's something like...

If $user.posts < 10 Then
redirect to NotEnoughPosts.html




can someone at least point me in the right direction?

4
Bassman
Re: (php) any help appreciated
  • 2005/4/6 2:40

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


I'm no php expert, but I found this section of code in edituser.php:
Quote:

if ($xoopsConfigUser['avatar_allow_upload'] == 1 && $xoopsUser->getVar('posts') >= $xoopsConfigUser['avatar_minposts']) {
include_once 'class/xoopsformloader.php';


Which basically checks to see if custom avatars are allowed, and if they are and the minimum post level is ok, it allows you to go to the avatar uploader form.

Not sure how useful this will be, or where exactly you would put it, but it's a start :)

5
Mantooth
Re: (php) any help appreciated
  • 2005/4/6 22:48

  • Mantooth

  • Friend of XOOPS

  • Posts: 189

  • Since: 2004/11/2


thankyou for the start and i appreciate your reply.

i'm going to start looking at some php tutorials and see if i can venture to write my first lines of php code.

if anyone else has any more advice, please let me know

6
m0nty
Re: (php) any help appreciated
  • 2005/4/7 1:26

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


in modules/wfdownloads/header.php

add this code just above $myts = & MyTextSanitizer :: getInstance(); // MyTextSanitizer object

if (!$xoopsUser->getVar('posts') >= 10) {
    
redirect_header("../../index.php"2_MD_WFD_NEEDMINPOSTS);
    exit();
}


then add this line just above ?> in wfdownloads/language/english/main.php

define("_MD_WFD_NEEDMINPOSTS","You Need A Minimum Of 10 Posts To Access Downloads");

7
Bassman
Re: (php) any help appreciated
  • 2005/4/7 1:38

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


Awesome M0nty, I knew it could be done, just needed someone smart enough to do it :)

8
m0nty
Re: (php) any help appreciated
  • 2005/4/7 1:41

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24


well i wouldn't say i'm smart.. not entirely sure that's the correct way of doing it or not, but it achieves the same goal :)

9
Mantooth
Re: (php) any help appreciated
  • 2005/4/10 18:22

  • Mantooth

  • Friend of XOOPS

  • Posts: 189

  • Since: 2004/11/2


@m0nty

thankyou so much for your help. I started reading some php tutorials so i could try and figure it out, but i didn't get far .

Login

Who's Online

248 user(s) are online (108 user(s) are browsing Support Forums)


Members: 0


Guests: 248


more...

Donat-O-Meter

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

Latest GitHub Commits