News:

Wondering if this will always be free?  See why free is better.

Main Menu

How to add a new profile field for admins?

Started by [SAP]Francis, August 13, 2008, 04:40:43 PM

Previous topic - Next topic

[SAP]Francis

I want to be able to set if a user is activated or not (is_activated field in members database.) in the Account Settings of members in their profiles. Which will activate or deactivate them.

How? :)

Vehicles Forum

Founded By Francis Morissette

[SiNaN]

Actually you have that option both in Profile and Admin CP for not activated accounts. So you also want to deactivate accounts?
Former SMF Core Developer | My Mods | SimplePortal

[SAP]Francis


Vehicles Forum

Founded By Francis Morissette

metallica48423

#3
Probably wouldn't be too hard to set up a link for it.  if you're looking for someone to do it i'd reccommend Mod Requests or Help Wanted (not for support)

seems like a simple query to do as well.

just add an action/subaction
check the permission for member management and check the session to make sure its not forged before its done
probably a js popup that asks if you're sure

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

[SAP]Francis

Nah, not a link, only a drop down box only seen by admins where when you press save, it updates the database. That's not hard, I just need to know what files to edit.

Vehicles Forum

Founded By Francis Morissette

metallica48423

I believe it'd be profile.template.php if its part of the profiles.  AFAIk that file does templating for all the template areas
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

[SAP]Francis

Well, is it Profile.php in sources when you press "Save"? :-\

Vehicles Forum

Founded By Francis Morissette

metallica48423

Yes, it would be, however, Profile.php doesn't actually display anything.  SMF's theming system seperates the actual work of gathering and preparing data between the Sources and the Themes.

So to actually display something you'd edit the template.  To do any data manipulation you'd want to edit the Profile.php.
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

[SiNaN]

Well, shouldn't be hard.

Profile.php

Find:

'secret_question' => !isset($user_profile[$memID]['secretQuestion']) ? '' : $user_profile[$memID]['secretQuestion'],

Replace:

'secret_question' => !isset($user_profile[$memID]['secretQuestion']) ? '' : $user_profile[$memID]['secretQuestion'],
'is_activated' => !isset($user_profile[$memID]['is_activated']) ? '0' : $user_profile[$memID]['is_activated'],


Find:

// Now call the sub-action function...

Replace:

// Maybe we are changing the account status?
if(isset($_POST['account_status']))
$profile_vars['is_activated'] = $_POST['account_status'];

// Now call the sub-action function...


Profile.template.php

Find:

<td><input type="text" name="posts" size="4" value="', $context['member']['posts'], '" /></td>

Replace:

<td><input type="text" name="posts" size="4" value="', $context['member']['posts'], '" /></td>
</tr>
<tr>
<td><b>Account Status: </b></td>
<td>
<select name="account_status">
<option value="0"', $context['member']['is_activated'] == 0 ? ' selected="selected"' : '', '>Pending</option>
<option value="1"', $context['member']['is_activated'] == 1 ? ' selected="selected"' : '', '>Activated</option>
</select>
</td>


Setting will appear under account settings.
Former SMF Core Developer | My Mods | SimplePortal

Advertisement: