View Single Post
  #3 (permalink)  
Old 01-09-2008, 10:54 AM
redwine's Avatar
redwine redwine is offline
Pligg Donor
 
Join Date: Jul 2007
Location: Canada
Posts: 216
Thanks: 20
Thanked 102 Times in 65 Posts
Extended profile

Quote:
Originally Posted by gen3ric View Post
I'm really close to releasing my first module that makes it easier to add extra fields to a user's profile. The module installs fine, stores data, users can edit the extra profile fields by clicking the "Modify" link and the modifications save to the database fine, but I just can't quite get the data retrieved and displayed in the profile view.

I'd appreciate it if someone with a little more experience take a look at what I have so far and lend a hand.
I will start from the section you need to retrieve the data to the profile and the modify profile:

*** Remember, this is an example for one field, you have to do the same for every field you added to the profile.
To get the data to the user profile.
Open /libs/user.php
Under the Class User { section, add the variables for the fields you added to the profile. Example:
Code:
var $car = '';
Look for function store() { and insert this anywhere after $user_email = $db->escape($this->email);
Code:
$user_car = $db->escape($this->car);
Few lines below where it starts with $sql .= " , user_login=
And insert the following right before the WHERE
Code:
, user_car='$user_car'
Go to function read() { and insert the following anywhere before the line that reads $this->read = true;
Code:
$this->car = $user->user_car;
Look for function fill_smarty($main_smarty, $stats = 1){
And insert this before the line that reads if($stats == 1){
Code:
$main_smarty->assign('user_car', $this->car);
Save and close.
Open /templates/yget/user_center.tpl
Look for <div id="personal_info">
And insert the following anywhere you want them to appear in the profile:

Code:
 
{if $user_car ne ""}
<tr>
<td><strong>{# PLIGG_Visual_User_Car#}:</strong></td>
</tr>
{/if}
Save and close.
Open /profile.php
Look for function show_profile() {
And insert the following before the line // pagename
Code:
$main_smarty->assign('user_car', $user->car);
Look for function save_profile() {
And insert the following before the line // module system hook
Code:
$user->car=cleanit($_POST['car']);
Open /templates/yget/profile_center.tpl
And insert this at the end of the first table before </table> Don’t forget to assign the tabindex
Code:
 
<tr>
<td><label class="req">{#PLIGG_Visual_User_Car#}:</label>
<input type="text" id="car" name="car" value="{$user_car}" class="textinput" size="30" tabindex="" maxlength="128" />
</td>
<td>&nbsp;</td> 
</tr>
Save and close
Reply With Quote
The Following 4 Users Say Thank You to redwine For This Useful Post: