Administrator approval for new users

Jason Jones Posted in General Discussion 9 years ago

User verification is fine but it does not stop unwanted access in the first instance. This is important as many people would like to use this software in a controlled access context I.E. in lieu of a group forum.

Is there a way to add final admin approval for users after verification? This would require an email to the admin informing them that accounts are pending.

or

Is it possible to create a plugin (similar to the Mobile Number) that adds a code field to the registration form. The code would be set, and easily changeable, in the admin area. Completion of the registration form without the code would return an error message informing the applicant that they should contact the admin.

Replies
Breton Claudio Silva Replied 7 years ago

I am confused.
Can we or cannot change the core files?
I need a way to control subscriptions to the system.
Is there a solution for that?
Actually, I need something to avoid subscriptions.
I would like to create my users as I decide to invite someone.
In other words, I need that the system be private, not for public access.

Finnish Olli Ovaskainen Replied 8 years ago

Hi all.. Cant find this component??

Romanian Fido Alex Replied 9 years ago

Ok Arsalan Shah , thank you!

Indonesian Arsalan Shah Replied 9 years ago

Please do not edit any core file and do not modify core database tables. We'll try to create a component for you.

in Sathish kumar Replied 9 years ago

@fido alex you shouldnt modify the core . without modify we can achieve that . i will try to create a plugin for that when i get time . if update your modification will be deleted

Romanian Fido Alex Replied 9 years ago

Guys here is the tutorial of my creation for the ADMIN APROVAL in OSSN

Step 1: 
>  Go to -> phpMyAdmin and insert in ossn_users a new field "aprove" the field type must be ''text''.

Step 2:
> Go to -> actions\administrator\user\edit.php
Add the following line's on the top of all line's

*Add this line In the $user firstname*
$user['aprove'] = input('aprove');

*In $params['names'] = array* 
 'aprove',

*In the $params['values']*
$user['aprove'],

*Again at the bottom of the page $params['values']*
$user['aprove'],

*Save edit.php and close'it!*

Step 3:
> Go to -> classes/OssnUser.php, and edit the following line that you will find on "public function Login"

*Edit:*  
if($password == $user->password && $user->activation == NULL

*With:* 
if($password == $user->password && $user->activation == NULL && $user->aprove == ACTIVATED) {

*When a user has ACTIVATED status saved in `aprove`, it will be able to log'in to the site, and if not, he can't :)*

Step 4:
> Go to -> system\plugins\default\forms\admin\user\edit.php
This is the edit file for the users that you will modify or activate the user from admin area.

*Here you have to paste all the `<div>` code after the* 
<?php $user = $params['user']; ?>` *Like this!*

<div>
<label> Activate/Deactivate User Access </label>
<select name="aprove">
<?php
if ($user->aprove == 'ACTIVATED') {
$activated= 'selected';
$deactivated= '';
}
if ($user->aprove == 'DEACTIVATED') {
$deactivated= 'selected';
$activated= '';}
?>
<option value="ACTIVATED" <?php echo $activated; ?>> ACTIVATE USER</option>
<option value="DEACTIVATED" <?php echo $deactivated; ?>> DEACTIVATE USER </option>
</select>
</div>

Step 5:
> I have the component verified-account from ossn, and here i have the file that is activated for the site
that is in -> components\verified-account\plugins\default\forms\admin\users\list.php, open end add this lines.

*In the*  `<table class="table ossn-users-list">` *add at the end of*  `<th>` *this line* <th>Activation Status</th>
*And then at the bottom of the page after last* `<td>` *line, paste this code:*
<?php if($user->aprove =='ACTIVATED') echo "<td style='background-color: #00FF00; text-align: center; width: 120px; height: 1px;color: white; padding: 14px 12px;font-weight: bold;'>".$user->aprove."</td>"; else if($user->aprove =='DEACTIVATED')  echo "<td style='background-color: #FF0000; text-align: center; width: 120px;  height: 1px;color: black; padding: 14px 12px;font-weight: bold;'>".$user->aprove."</td>"
 ?>

>HOPE YOU WILL ENJOY'IT - IF ANYONE HAS QUESTIONS, JUST ASK :)

Romanian Fido Alex Replied 9 years ago

Guys here is the tutorial of my creation for the ADMIN APROVAL in OSSN

Step 1:
> Go to -> phpMyAdmin and insert in ossn_users a new field "aprove" the field type must be ''text''.

Step 2:
> Go to -> actions\administrator\user\edit.php
Add the following line's on the top of all line's

Add this line In the $user firstname
$user["aprove"] = input("aprove");

In $params['names'] = array
"aprove",

In the $params['values']
$user["aprove"],

Again at the bottom of the page $params['values']
$user["aprove"],

Save edit.php and close'it!

Step 3:
> Go to -> classes/OssnUser.php, and edit the following line that you will find on "public function Login"

Edit:
if($password == $user-&gt;password &amp;&amp; $user-&gt;activation == NULL

With:
if($password == $user-&gt;password &amp;&amp; $user-&gt;activation == NULL &amp;&amp; $user-&gt;aprove == ACTIVATED) {

When a user has ACTIVATED status saved in aprove, it will be able to log'in to the site, and if not, he can't :)

Step 4:
> Go to -> system\plugins\default\forms\admin\user\edit.php
This is the edit file for the users that you will modify or activate the user from admin area.

Here you have to paste all the &lt;div&gt; code after the
>&lt;?php $user = $params["user"]; ?&gt; Like this!

&lt;div&gt; &lt;label&gt; Activate/Deactivate User Access &lt;/label&gt; &lt;select name=&quot;aprove&quot;&gt; &lt;?php if ($user-&gt;aprove == "ACTIVATED") { $activated= "selected"; $deactivated= ""; } if ($user-&gt;aprove == "DEACTIVATED") { $deactivated= "selected"; $activated= "";} ?&gt; &lt;option value=&quot;ACTIVATED&quot; &lt;?php echo $activated; ?&gt;&gt; ACTIVATE USER&lt;/option&gt; &lt;option value=&quot;DEACTIVATED&quot; &lt;?php echo $deactivated; ?&gt;&gt; DEACTIVATE USER &lt;/option&gt; &lt;/select&gt; &lt;/div&gt;

Step 5:
> I have the component verified-account from ossn, and here i have the file that is activated for the site
that is in -> components\verified-account\plugins\default\forms\admin\users\list.php, open end add this lines.

In the &lt;table class=&quot;table ossn-users-list&quot;&gt; add at the end of &lt;th&gt; this line &lt;th&gt;Activation Status&lt;/th&gt;
And then at the bottom of the page after last &lt;td&gt; line, paste this code:
&lt;?php if($user-&gt;aprove =="ACTIVATED") echo &quot;&lt;td style="background-color: #00FF00; text-align: center; width: 120px; height: 1px;color: white; padding: 14px 12px;font-weight: bold;"&gt;&quot;.$user-&gt;aprove.&quot;&lt;/td&gt;&quot;; else if($user-&gt;aprove =="DEACTIVATED") echo &quot;&lt;td style="background-color: #FF0000; text-align: center; width: 120px; height: 1px;color: black; padding: 14px 12px;font-weight: bold;"&gt;&quot;.$user-&gt;aprove.&quot;&lt;/td&gt;&quot; ?&gt;
>HOPE YOU WILL ENJOY'IT - IF ANYONE HAS QUESTIONS, JUST ASK :)

us Jeremy Monroe Replied 9 years ago

Has this component been uploaded yet? Thanks.

au Jason Jones Replied 9 years ago

Could you please upload to the components area:
https://www.opensource-socialnetwork.org/components/all

Cheers,

Jase

Romanian Fido Alex Replied 9 years ago

Done with the name & done with the admin aproval! I made'it work!
So.. Jase please leave me an email or something to give u the right informations how to manage the admin aproval..i don't know if i'm allowed here to share a link for download.
I made some status for admin aproval as "activated" & "deactivated" and for activation u have to trigger the "edit profile" in list users area.enter image description here

enter image description here