Advertisement:

Author Topic: How to add a new profile field for admins?  (Read 5363 times)

Offline [SAP]Francis

  • Full Member
  • ***
  • Posts: 543
  • Gender: Male
  • FastRides Owner and Founder
    • FastRides
How to add a new profile field for admins?
« on: August 13, 2008, 04:40:43 PM »
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

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,524
  • Young and Foolish
    • SimplePortal
Re: How to add a new profile field for admins?
« Reply #1 on: August 14, 2008, 08:35:49 AM »
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

Offline [SAP]Francis

  • Full Member
  • ***
  • Posts: 543
  • Gender: Male
  • FastRides Owner and Founder
    • FastRides
Re: How to add a new profile field for admins?
« Reply #2 on: August 14, 2008, 11:39:55 AM »
You're right, Sinan. That's what I want ;)

Vehicles Forum

Founded By Francis Morissette

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: How to add a new profile field for admins?
« Reply #3 on: August 15, 2008, 01:48:00 AM »
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

« Last Edit: August 15, 2008, 01:50:03 AM by metallica48423 »
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

Quote
Microsoft 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
     

Offline [SAP]Francis

  • Full Member
  • ***
  • Posts: 543
  • Gender: Male
  • FastRides Owner and Founder
    • FastRides
Re: How to add a new profile field for admins?
« Reply #4 on: August 15, 2008, 01:57:57 AM »
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

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: How to add a new profile field for admins?
« Reply #5 on: August 15, 2008, 01:59:24 AM »
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

Quote
Microsoft 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
     

Offline [SAP]Francis

  • Full Member
  • ***
  • Posts: 543
  • Gender: Male
  • FastRides Owner and Founder
    • FastRides
Re: How to add a new profile field for admins?
« Reply #6 on: August 15, 2008, 02:02:16 AM »
Well, is it Profile.php in sources when you press "Save"? :-\

Vehicles Forum

Founded By Francis Morissette

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: How to add a new profile field for admins?
« Reply #7 on: August 15, 2008, 02:07:02 AM »
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

Quote
Microsoft 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
     

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,524
  • Young and Foolish
    • SimplePortal
Re: How to add a new profile field for admins?
« Reply #8 on: August 15, 2008, 10:23:11 AM »
Well, shouldn't be hard.

Profile.php

Find:

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

Code: [Select]
'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:

Code: [Select]
// Now call the sub-action function...
Replace:

Code: [Select]
// 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:

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

Code: [Select]
<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