The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need ability to approve new user
#1
Hi. I'm new to Userspice so please be gentle.
I am creating an online course and using Userspice to enable clients access the course
Clients need to make a payment before access is allowed
I would like them to be able to register, using the form here - users/join.php, then be redirected to my payment page
Once they have made the payment, I then want to be able to "approve" their registration in the admin panel and give them access to the course.
Could someone please explain how I can go about this?
Currently, once they complete the registration form, they can access the course immediately without making the payment
Thanks in advance
  Reply
#2
No worries at all. People are not mean on our forums. What I do in that situation is create a new access level called staff or approved user or something like that and only a sign of two people after I approved them. I can give you a more technical explanation if you need it but I am on my phone so difficult now.
  Reply
#3
Sorry. That was really bad voice to text. What you need to do is make a new user permission called student. Then assign all of your class PHP files to permission level of student. The only way someone can get that permission level is if you assign it to them. If you look in the documentation menu there is something called functions. In there there is one called has perm. You can basically a flash a banner or something if someone does not have the permission of student to let them know that their account has not yet been verified.
  Reply
#4
Thanks Dan. I'll try that and let you know how I get on
  Reply
#5
Hi Dan

Thanks - I've managed to set up the new user permission - STUDENT - and prevent access to a page until I change the client's permission to STUDENT. So far so good.

However, I'm a bit lost with the function. From what I understand, if the client hasn't paid and their permission is still set to USER, I can show a banner or alert that displays when the client tries to access a STUDENT protected page.

I can't work out how to do it. I have looked at a file called us_helpers.php that has, on line 769, a reference to the hasperm function you mentioned, but I'm not sure how to implement the banner/alert

Could you point me in the right direction please

Thanks
  Reply
#6
You could use
Code:
checkPermission()
or
Code:
checkMenu()
from us_helpers.php, and when they don't have permission you can
Code:
Redirect::to('payments.php')
(or whatever your payment pay is called). This will redirect anyone without the STUDENT permission to your payment page.

Code:
//When placed before securePage() this will redirect to your custom page
Code:
if (!checkPermission($studentPermissionId)){Redirect::to('payments.php');}
Code:
// If placed before checkPermission() this will redirect to account.php
Code:
// when logged in or login.php if not, but doesn't send them to
Code:
// your custom payment page
Code:
if (!securePage($_SERVER['PHP_SELF'])){die();}
Code:
echo 'Hello Student, you have permission to view this course.';

I use a customer permissions system so there may be a more optimum way for you to do this but give it a shot and see if it works for you.
  Reply
#7
Hi Karsen

Thanks for your help. I will try that
  Reply
#8
Hi

I looked at that but it's too complicated for me.

I think what I'd like to do is this

Currently, when someone logs in, they are sent to this page - users/account.php

Ideally, I would like to change this DIV on line 53 as follows

<div class="col-xs-12 col-md-9">
<h1><?=ucfirst($user->data()->username)?></h1>
<p><?=ucfirst($user->data()->fname)." ".ucfirst($user->data()->lname)?></p>
<p>Member Since:<?=$signupdate?></p>
<p>Number of Logins: <?=$user->data()->logins?></p>

(If client is USER, show this text)

Your payment has not yet been processed. Please click here to Log Out

(If client is STUDENT, show this)

<p>Click here to enter the Online Programme</p>
</div>

Could you let me know how to do this?
Thank in advance
  Reply
#9
simple if statement should do it:

<pre>
Code:
if(checkMenu(2,$user->data->id) {
    
     // your student data here
}else{

     // everyone else data
}
</pre>



replace the 2 with the student perm id.

instead of asking to logout you could do a redirect to logout.php so they will be automatically logged out
  Reply
#10
Hi Firestorm

Thanks for the idea, although I still can't quite make it work

I have put the following in

<?
if(checkMenu(3,$user->data->id) {
echo "<p>Not yet registered. Click here to return to Home page</p>";
} else {
echo "<p>Click here to enter the Online Programme</p>";

}
?>

But I get this error message

Parse error: syntax error, unexpected '{' in /var/sites/public_html/onlinecourse/users/account.php on line 61

Line 61 is this

if(checkMenu(3,$user->data->id) {

Am I making a simple error?

  Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)