News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Custom Profile Field Mod

Started by winrules, March 30, 2006, 02:21:25 PM

Previous topic - Next topic

blisster

Hi-

I'm new to SMF, but not new to adminning forums. I just installed this mod (v.3.16) on my forum (SMF version 1.1.2). the install seemed to work properly, but I can't find any configuration options for the mod anywhere in the admin menu. My understanding is that it should be under the 'Features and Options' menu, but I don't see anything there  ??? Any ideas or suggestions would rock.

Jack

TrueSatan

Jack,

Almost all mods only install into the default theme...are you using another theme? If so please see if the mod is working properly in the default theme.

If the above is the case you'll need to install the mod manually into your custom theme.

blisster

I'm currently using the default theme.


TrueSatan

 Firstly please check to see that your forum language is set to English and not English utf8...this sometimes stops mods from working.

When installing I presume (seeing as you said you were an experienced admin) that no fails were shown by the package manager? Forgive me confirming this but best be sure.

Did you, prior to installing the mod go to:

Admin>Packages>Options

Fill in the details in "Installation Options"

Then in "Cleanup Permissions" select "All files are writable" and click on "Change file permissions"?

Following that it is wise to make sure that all the files are set to CHMOD 775 or 777 (depending on the hosting of your server) via an ftp client.

You should do the above step prior to installing any mod.

Assuming all files were at the right CHMOD setting then it would be wise to manually check that the mod installed into each one mentioned in the modification.xml file in the package (unzip the package and you'll find that file and the detaisl of the files the mod installs into and what changes are made.)

You could instead use the "Package Parser" to read the package modification details and then check the files to see that the modifications had been done...http://www.modparser.dev.dansoftaustralia.net

merosler

Hello,

I installed the Profile Field Module (v. 3.16) and integrated it into the latest smf -default theme.

I got all the profile fields to show up below the user's name in the posts, however as a user, when I go to try to modify what I just entered into my newly created profile fields, I don't see any of the fields incorporated into this page:

http://www.mydomain.com/smf/index.php?action=profile;u=1;sa=account
Modify Profile->Account Related Settings

Where am I supposed to edit these new fields once after I enter the info into the registration page?  Why do you suppose these new profile fields are not showing up when I go to edit my profile

http://www.went2networks.com/smf

thanks,
Matt

merosler

Hi,

I've read through about 38 pages of this post so far and I see that all the profile data is  stored in the "Themes table".

How/where do I access this "themes table"?

thanks,
matt


KreedGhost

I installed the mod and don't have anyting show in features and options to edit through it. Anyone got any pointers?

B12

Quote from: rpalmer68 on May 04, 2007, 08:14:32 AM
OK, I've read through all 58 pages of this topoc and have determined that I can't gather the data directly with an SQL query but will need to create a .php page to generate and then display the data I need in the correct format.

So at this point I'm totally stuck!

I read a few posts about ssi and things but I'm afraid I'm totally new to all of this and it went right over my head.

Can somebody PLEASE give me the code I need to add and instruction on where I need to add it to achieve the following???


I need to create a printed membership phone list for a concert band I have setup to use SMF 1.1.2 with the custom profile mod.

I have custom fields setup as below;

CP_instrument, CP_homePhone, CP_workPhone, CP_mobilePhone, CP_homeAddress

So how do I create a page that displays a phone list that members could then print to get a hard copy

I really wold appreciate some guidance/help as I need to somehow get the data out so I don't have to maintain an XL spreadsheet as well just to print out a membership list for people.

Many thanks
Richard
Sydney, Australia

Hi Richard,

is this something you could use?
save it as phonelist.php or something like that....dont forget to put your database settings in.

<?
mysql_connect("localhost","YOUR DATABASE USERNAME","YOUR DATABASE PASSWORD");
mysql_select_db("YOUR DATABASE NAME");

$select = "SELECT ID_MEMBER  FROM smf_themes WHERE variable = 'CP_instrument' ORDER BY ID_MEMBER";
$query = mysql_query($select)or die(mysql_error());

echo "<table>";
echo "<tr>";
echo  "<td>Member nr. </td><td>Nickname</td><td>instrument</td><td>homePhone</td><td>workPhone</td><td>mobilePhone</td><td>homeAddress</td>" ;
echo "</tr>";

while($list = mysql_fetch_object($query))
{
echo "<tr>";
$id = $list->ID_MEMBER;



//--- get the instrument from the database
$sql = "SELECT value FROM smf_themes WHERE ID_MEMBER = " . $id . " AND variable = 'CP_instrument'";
$res = mysql_query($sql);
$instrument = mysql_result($res, 0);



//--- get the homePhone from the database
$sql = "SELECT value FROM smf_themes WHERE ID_MEMBER = " . $id . " AND variable = 'CP_homePhone'";
$res = mysql_query($sql);
$homePhone = mysql_result($res, 0);



//--- get the workPhone from the database
$sql = "SELECT value FROM smf_themes WHERE ID_MEMBER = " . $id . " AND variable = 'CP_workPhone'";
$res = mysql_query($sql);
$workPhone = mysql_result($res, 0);


//--- get the mobilePhone from the database
$sql = "SELECT value FROM smf_themes WHERE ID_MEMBER = " . $id . " AND variable = 'CP_mobilePhone'";
$res = mysql_query($sql);
$mobilePhone = mysql_result($res, 0);


//--- get the homeAddress from the database
$sql = "SELECT value FROM smf_themes WHERE ID_MEMBER = " . $id . " AND variable = 'CP_homeAddress'";
$res = mysql_query($sql);
$homeAddress = mysql_result($res, 0);



//--- get the membername from the database
$sql = "SELECT memberName FROM smf_members WHERE ID_MEMBER = " . $id;
$res = mysql_query($sql);
$memberName = mysql_result($res, 0);

//--- echo the results
echo  "<td>$id </td><td>$memberName</td><td>$instrument</td><td>$homePhone</td><td>$workPhone</td><td>$mobilePhone</td><td>$homeAddress</td>" ;
echo "</tr>";
}
echo "</table>"
?>

SunilDVR

I notice that several people have trouble extracting all the data they need from the fields in this mod. I assume this is because of the way that it stores the data in smf_themes (rows).

I had problems with this, but I enlisted the help of my father, who has been working on databases for many years. He came up with the basic code which I tweaked.

This assumes that you wish to get the user ID number (ID_MEMBER), the display name (memberName) and the e-mail address (emailAddress) from smf_members...... as well as two custom profile fields from the smf_themes table.

In my case, I left the names as default (cp1 and cp2), which hold the Full Name and Membership Number of the users respectively.

The following command creates one table outputting all of these five variables, for every forum member, using self-joins.

SELECT smf_members.ID_MEMBER
,smf_members.memberName
,smf_members.emailAddress
,full_name.value
,member_no.value


FROM smf_members
,smf_themes AS full_name
,smf_themes AS member_no

WHERE (smf_members.ID_MEMBER       =        full_name.ID_MEMBER
AND smf_members.ID_MEMBER       =        member_no.ID_MEMBER
AND full_name.variable                    =         'cp1'
AND member_no.variable                 =         'cp2')

ORDER BY ID_MEMBER


This code can be tweaked as necessary to retrieve whatever custom fields you wish. I'm not doing anything exciting with this code, but I guess it should work with more than two variables, suitably amended. As an example, to answer Richard's request above I reckon that the following should work (no guarantees, I'm not an expert on this!):


SELECT ,smf_members.memberName
,instrument.value
,homephone.value
,workphone.value
,mobilephone.value
,homeaddress.value

FROM smf_members
,smf_themes AS instrument
,smf_themes AS homephone
,smf_themes AS workphone
,smf_themes AS mobilephone
,smf_themes AS homeaddress

WHERE (smf_members.ID_MEMBER       =        instrument.ID_MEMBER
AND smf_members.ID_MEMBER       =        homephone.ID_MEMBER
AND smf_members.ID_MEMBER       =        workphone.ID_MEMBER
AND smf_members.ID_MEMBER       =        mobilephone.ID_MEMBER
AND smf_members.ID_MEMBER       =        homeaddress.ID_MEMBER

AND instrument.variable                    =         'CP_instrument'
AND homephone.variable                    =         'CP_homePhone'
AND workphone.variable                    =         'CP_workPhone'
AND mobilephone.variable                    =         'CP_mobilePhone'
AND homeaddress.variable                    =         'CP_homeAddress')

ORDER BY ID_MEMBER


When you start having lots of custom fields, this could get very messy (and possibly inefficient too), but it's the only way I have been able to find of getting the info out.

Would love to be corrected!




One question I do have for the mod developer:

SMF 2.0 - which includes custom fields as part of the main codebase - has been announced. Beta is not due until October, so final release I imagine would be next year at the very very earliest... but:

Will you be able to provide a way to migrate the contents of custom profile fields for us? Pretty please? I am not advanced enough with databases to try and do this manually, when the time eventually comes...

Thanks

Sunil

rpalmer68

Thanks for your responses B12 and Sunil.

B12, this is exactly what I needed, now I can just massage the formatting to what I need.

One more question;
I want the Members "realName" (in the members table) as column one rather than ID_MEMBER and it sorted by the surname if possible.
I can get the "realName" from the memebers table and put this in the first column, but would it possible to extract the surname from the value and sort the column by the surname?

Many thanks again
Richard

tsmalmbe

Quote from: miken on April 01, 2007, 10:46:09 AM
I've just been having the same problem. But from looking through it it seems it also needs $context['members']['options'] setting to global $options

Thanks, you made my day.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Teunel

Thanks for the mod, I really love it.
I do have one question: I need to have the variable (I don't know if that's the exact name) of the input. As an example: If you want to display their username, you'll have to place ['member']['username'] in the code. What do I have to put their if I want to show the custom field? Is that the Field ID?

brelwit

#1172
Quote from: SunilDVR on May 12, 2007, 04:20:03 PM
I notice that several people have trouble extracting all the data they need from the fields in this mod. I assume this is because of the way that it stores the data in smf_themes (rows).

I had problems with this, but I enlisted the help of my father, who has been working on databases for many years. He came up with the basic code which I tweaked.

This assumes that you wish to get the user ID number (ID_MEMBER), the display name (memberName) and the e-mail address (emailAddress) from smf_members...... as well as two custom profile fields from the smf_themes table.

In my case, I left the names as default (cp1 and cp2), which hold the Full Name and Membership Number of the users respectively.

The following command creates one table outputting all of these five variables, for every forum member, using self-joins.

SELECT smf_members.ID_MEMBER
,smf_members.memberName
,smf_members.emailAddress
,full_name.value
,member_no.value


FROM smf_members
,smf_themes AS full_name
,smf_themes AS member_no

WHERE (smf_members.ID_MEMBER&nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp; full_name.ID_MEMBER
AND smf_members.ID_MEMBER&nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp; member_no.ID_MEMBER
AND full_name.variable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 'cp1'
AND member_no.variable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 'cp2')

ORDER BY ID_MEMBER


This code can be tweaked as necessary to retrieve whatever custom fields you wish. I'm not doing anything exciting with this code, but I guess it should work with more than two variables, suitably amended. As an example, to answer Richard's request above I reckon that the following should work (no guarantees, I'm not an expert on this!):


SELECT ,smf_members.memberName
,instrument.value
,homephone.value
,workphone.value
,mobilephone.value
,homeaddress.value

FROM smf_members
,smf_themes AS instrument
,smf_themes AS homephone
,smf_themes AS workphone
,smf_themes AS mobilephone
,smf_themes AS homeaddress

WHERE (smf_members.ID_MEMBER&nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp; instrument.ID_MEMBER
AND smf_members.ID_MEMBER&nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp; homephone.ID_MEMBER
AND smf_members.ID_MEMBER&nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp; workphone.ID_MEMBER
AND smf_members.ID_MEMBER&nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp; mobilephone.ID_MEMBER
AND smf_members.ID_MEMBER&nbsp; &nbsp; &nbsp;&nbsp; =&nbsp; &nbsp; &nbsp; &nbsp; homeaddress.ID_MEMBER

AND instrument.variable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 'CP_instrument'
AND homephone.variable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 'CP_homePhone'
AND workphone.variable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 'CP_workPhone'
AND mobilephone.variable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 'CP_mobilePhone'
AND homeaddress.variable&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 'CP_homeAddress')

ORDER BY ID_MEMBER


When you start having lots of custom fields, this could get very messy (and possibly inefficient too), but it's the only way I have been able to find of getting the info out.

Would love to be corrected!




One question I do have for the mod developer:

SMF 2.0 - which includes custom fields as part of the main codebase - has been announced. Beta is not due until October, so final release I imagine would be next year at the very very earliest... but:

Will you be able to provide a way to migrate the contents of custom profile fields for us? Pretty please? I am not advanced enough with databases to try and do this manually, when the time eventually comes...

Thanks

Sunil

This does not work for me. How do I grab each custom profle field? Using a 'while' loop does not work for the smf_themes fields.  Only those fields from smf_members is grabbed and displayed.  Can you give an example on this?

joybreezy

How do I make a custom field show in profile for a custom theme?


brelwit

#1175
I am trying to create a new page called Member's Directory using this Mod Custom Profile and the Custom Actions Mod. I am using PHP as scripting language for this which is set in the Custom Actions Mod.

Now, I know a little bit of PHP & MySQL and decided to use my own codes instead of trying to load required SMF variables and functions to query and display records. So I did some MySQL query but can't seem to grab the correct records and list them all in tabular format having the ff. data as example:

- Online Status
- Username
- Positions
- City
- Country
- Mobile Phone

The "Online Status", "Username", and "Positions" field from the smf_members database table is correctly grabbed and displayed in my listing but the three fields from smf_themes database table which is "City", Country", and "Mobile Phone" appears blank. To illustrate, my table listing incorrectly displays the ff. data per record:

Online Status - Username - Positions - [blank] - [blank] - [blank]

My question is, how do I grab those three fields from smf_themes and display them as well in my table listing? What is the correct MySQL query and PHP code (while loop) do I use?

Thanks and hoping somebody can help me! :)

rpalmer68

brelwit,

See the posting from B12 further up this page, it should give you enough info to get what you need working as it's working for me as a php page.

Richard

brelwit

I
Quote from: rpalmer68 on May 20, 2007, 11:19:58 PM
brelwit,

See the posting from B12 further up this page, it should give you enough info to get what you need working as it's working for me as a php page.

Richard

Hi!  I've already read all the postings in this thread and it didn't give any clue on how to display records in tabular format.  It only has info on grabbing data of one record in displaying it in the Profile page.  What I want to do is display ALL Member records and grabbing data from both smf_members and smf_themes database tables. 

Later on, I will also include a Filter combo menu on the top of my Member Listing page so it can grab only those records with selected data.

I just need a sample PHP code using "while" loop and the corresponding MySQL query that grabs data from both smf_members and smf_themes database tables.  If anyone can give me an actual sample or point me to the right direction, I would appreciate it.  :)

tsmalmbe

Quote from: Teunel on May 18, 2007, 04:50:03 AM
Thanks for the mod, I really love it.
I do have one question: I need to have the variable (I don't know if that's the exact name) of the input. As an example: If you want to display their username, you'll have to place ['member']['username'] in the code. What do I have to put their if I want to show the custom field? Is that the Field ID?

A suggestion.

I put the following at the end of my index.template.php. The $filedid is the name of the field as you named it when you created it. With this method you can make use of the profilefields almost everywhere. I use it to give the users the capability to "personalise" - choose - what they want to see on the frontpage.

// This is for custom profile fields
// $options should be passed as the global $options if you want the currently logged on user
// $options should be passed as $context['member']['options'] if you want a specific member in the profiletemplate

function findCustomProfileFieldById ($fieldID,$options)
{   

   global $context, $settings,  $scripturl, $modSettings, $txt , $sourcedir;
   $context['user']['options'] = $options;

   $iii = 1;
   while (isset($modSettings['enable_CP' . $iii . '']))
   {
      if ($modSettings['enable_CP' . $iii . ''])
      {
         if ($modSettings['CP' . $iii . '_id'] == $fieldID)
         {
            return $context['user']['options'][$modSettings['CP' . $iii . '_id']];
         }
      }
      $iii++;
   }
}
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Kindred

nice function...

it should probably be placed in sources/subs.php rather than in a template...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: