News:

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

Main Menu

Custom Profile Field Mod

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

Previous topic - Next topic

BadOctane

Wondering if there is a way I can add this to say SSI to display a certain text field?

Basically, I have a text field that keeps track of someones tournament wins (simple numberic form)
I'd like to be able to display the top 10 winning members.

Any way todo this?

rpalmer68

#1261
Quote from: rpalmer68 on June 25, 2007, 08:54:12 PM

while($list = mysql_fetch_object($query))
{
$id = $list->ID_MEMBER;

//--- Check if user should be displayed
$sql = "SELECT value FROM smf_themes WHERE ID_MEMBER = " . $id . " AND variable = 'CP_hide'";
$res = mysql_query($sql);
$hide = mysql_result($res, 0);

If ($hide != "1")
{
echo "<tr>";
//--- 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);



Now when I generate my list I get a page or warning messages like

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 251 in /home/lccb/public_html/members/phonelist_print.php on line 35


And then after all the warnings I get my generated list with the correct members hidden.


(Line 35 is the $hide = mysql_result($res, 0); line)

Any ideas what's causing the warnings and how to fix them or hide them?

Many thanks
Richard

OK after much searching and testing I've managed to get something working, so thought I should post my findings for others in case you also have problems.

I changed the code to fetch the row and this seems to work although I really don't understand why the other code works for every field except the CP_hide field!

So new code looks like this;
//--- Check if user should be displayed
$sql = "SELECT value FROM smf_themes WHERE ID_MEMBER = " . $id . " AND variable = 'CP_hide'";
$res = mysql_query($sql);
$row = mysql_fetch_row($res);
$hide = $row[0];
if ($hide != 1)
{


Richard

misterdan

The custom profile field only shows on members who have registered after I installed the script. it does not show on members who have registered before I installed the script. Why is this? Ideas on fixing?

Thanks,
Dan

m@d

QuotePerplexed,

Actually, I was able to get it to work, but only on one field - so far...

I created a few custom fields using the Custom Profile Field MOD for First Name, Last Name, Address etc...

So, I went into the Memberlist.php file and made the modifications to include my new custom profile fields on the mlist.

Then, I setup the query:

// Select the members from the database.
   $request = db_query("
      SELECT mem.ID [nofollow]_MEMBER, th.ID [nofollow]_MEMBER, th.variable, th.value
      FROM {$db_prefix}members AS mem" . ($_REQUEST['sort'] === 'isOnline' ? "
         LEFT JOIN {$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID [nofollow]_MEMBER)" : '') . ($_REQUEST['sort'] === 'ID_GROUP' ? "
         LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID [nofollow]_POST_GROUP, mem.ID [nofollow]_GROUP))" : '') . "
         LEFT JOIN {$db_prefix}themes AS th on (th.ID_MEMBER = mem.ID [nofollow]_MEMBER AND th.variable = 'first_name')
               WHERE mem.is [nofollow]_activated = 1" . (empty($where) ? '' : "
         AND $where") . "
               ORDER BY " . $sort_methods[$_REQUEST['sort']][$context['sort_direction']] . "
      LIMIT $limit, $modSettings[defaultMaxMembers]", __FILE__, __LINE__);
   printMemberListRows($request);
   mysql_free_result($request);

Then I setup the sort methods:

// List out the different sorting methods...
   ),
   'firstName' => array(
   'down' => 'th.value ASC',
   'up' => 'th.value DESC'
   ),
   'lastName' => array(
   'down' => 'th.value ASC',
   'up' => 'th.value DESC'


So far, it works for just one of the variables and blows up when I try to add more than one Custom Profile field to sort on.  But, I am still working on this.  Its pretty cool that I was able to get the first_name field to sort but I need to have the ability to have the rest of my fields sort.



rgum

I have tested this code from rgum for one custom profile field, it dont really works ,  my problem is when a Member from my forum leave this profile field blank then he is not listed in the Memberlist.
Any ideas?
Sorry for my bad English  :-[

madagascar

#1264
hi all,

1. how to increase the size of the text area. for example. the member will say something about themselves and it needs a large box or input field. And also to impose max of 300 characters.
2. Location of the member will appear on his/her every post.
3. Want to add 3 - 5 thumbnail pictures inline with the avatar that is link from  their gallery.

thanks in advance
:)

madagascar

any help please. thnks

Quote from: madagascar on July 01, 2007, 12:40:52 AM
hi all,

1. how to increase the size of the text area. for example. the member will say something about themselves and it needs a large box or input field. And also to impose max of 300 characters.
2. Location of the member will appear on his/her every post.
3. Want to add 3 - 5 thumbnail pictures inline with the avatar that is link from  their gallery.

thanks in advance
:)

Pranav

Hey does this mod work with SMF 1.1.3 ?

Kindred

madagascar,

You're asking for some pretty in depth modification to the mod...  I suggest you try learning some php and experiment. :)

ulgaming...
It won' work out of the box... you will have to emulate 1.1 or modify the XML file to include 1.1.3
Сл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."

madagascar

Quote from: Kindred on July 01, 2007, 10:29:17 PM
madagascar,

You're asking for some pretty in depth modification to the mod...  I suggest you try learning some php and experiment. :)


thanks for your advise, yeah, i will try to read books and learn about php. But if you have any idea how to do it. Care to share with us here.  :)

thanks in advance

TrueSatan

@ulgaming.net and @ Kindred

The mod already supports all SMF versions up to 1.1.99 (already in the xml file)

Kindred

madagascar,

well, number one would require you to edit the basic entry. Fairly eays once you track it down.  I don't recall, off the top of my head where that function resides....

number 2 would require a modification to display.template.php

number 3 would not be related to this mod at all, but would be a modification to display.template.php that involves your gallery mod.
Сл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."

madagascar

Quote from: Kindred on July 02, 2007, 08:02:09 AM
madagascar,

well, number one would require you to edit the basic entry. Fairly eays once you track it down.  I don't recall, off the top of my head where that function resides....

number 2 would require a modification to display.template.php

number 3 would not be related to this mod at all, but would be a modification to display.template.php that involves your gallery mod.

thank you so much kindred. at least i have this info in my head.

universe

Hi tfisher
Seems I have same problem with custom profile mod because gallery2 integration
so I am just curious what you did that thing worked please?

samames

I'd just like to congratulate the creator of this mod; It is brilliant. I tried it a few months back and it broke my board for a while, but since I have moved hosts and had the courage to try it again, this time with great success! THANKS!!

If anyone wants ideas for profile fields feel free to check out my 'register' page on my board at http://www.liveonfire.net/community
God bless all :)
Firefox 3 user. Mac user. Pc user.

TrueSatan

@samames

SMF advise that you should backup both your database and your files prior to installing or uninstalling any mod so that in the event of problems such as you describe having had you can restore from backup with no harm done.

phpchris


TrueSatan

Please read my earlier reply to this question.

Farmacija

error log says
Quote: Undefined index: cp_cpfields
Datoteka: /home/farmaceu/public_html/forum/Sources/ModSettings.php
Linija: 153
www.farmaceuti.com
www.farmaceuti.com/tekstovi

Kalika

Hello.. I was just wondering, is there any way with this mod to set how the fields show up in your profile?  I ask because I am using this for an RPG forum, and I want to seperate the in-character info from the out of character info.  Right now I have got in character information junbled in with ICQ and website URL info.. it's kinda confusing.   ::)

Thanks for any thoughts!

Kindred

manually modify profile.template.php and insert the hr and line breaks where you want them betwene the normal profile stuff and the custom stuff.
Сл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: