Advertisement:

Author Topic: Removing and Adding Columns In The Members List!  (Read 8686 times)

Offline Mr_JimWest

  • Semi-Newbie
  • *
  • Posts: 71
  • Gender: Male
  • http://jw-renders.com
    • JW-Renders
Removing and Adding Columns In The Members List!
« on: October 21, 2008, 12:08:30 AM »
Ok hello there, I want to thank all of you who read this in advance!  8)

I am currently trying to take out a few of the columns on the Member List page on my SMF forum. I would like to replace one or how many columns with group ranks (member group pictures)!  ;D

Right now I replaced the member group stars with military ranks, like private, recruit, commander, and so on!

Since I have various members with various ranks I would like to figure out how to replace one of the excising columns – like “ICQ”, with their main member group image!

I would like you all to know: I know very little PHP and stuff, so I need simple clear instructions – PLEASE!


Below Is Less Important (Top need to be done first)  ;)

Also my clan (forums are for a clan) relies heavily on Xfire (Gamers IM-ing program), instead of those other IM-ing programs! So I would like to replace, let’s say “YIM”, with a little Xfire decal – if they filled in that spot in there profile – which I have the mod for (found a mod for Xfire in the profile on this site)!


Other Info  O:)
Site: http://Royal-Rangers-Clan.com
Forums Link: http://royal-rangers-clan.com/Forums/
Members Page Link: http://royal-rangers-clan.com/Forums/index.php?action=mlist

Offline Deaks

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 22,533
  • Gender: Male
    • trekkiesforyes on Facebook
    • pouvik on GitHub
    • @trekkies4yes on Twitter
    • YES
Re: Removing and Adding Columns In The Members List!
« Reply #1 on: October 23, 2008, 02:53:10 PM »
this would be done in memberlistindex.template now as for how I will ask a SS to  look at this these guys no more about coding then myself :)

Offline Nathaniel

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,117
  • Gender: Male
    • Verbtest.com
Re: Removing and Adding Columns In The Members List!
« Reply #2 on: October 23, 2008, 04:33:02 PM »
This is a simple little tutorial about adding new columns to the memberlist. It doesn't cover adding new columns to the database (which may be required) or complicated adding of new columns. I will need some more information about the 'Ranks' that you want to add before I can help you more with that.

Ie.
Do you want to replace the current rank text column with graphics?
Which mod/mods are you using to show the bages/ranks?

Also, the edits below are for SMF 1.1.x, although they are very similar for SMF 2 Beta. ;)

Editing the 'MemberList.php' file:


Firstly, you will need to add the column itself. Find the code below:
Code: [Select]
$context['columns'] = array(
That array contains a list of all of the columns for your Memberlist, this is an example for your 'Xfire' column.
Code: [Select]
        'xfire' => array(
            'label' => 'Xfire',
        ),

You will also have to add some more code if you want it to be sortable. Find the code below.
Code: [Select]
$sort_methods = array(
That array contains a list of all the sort methods for your memberlist, and example for your 'Xfire' column is below:
Code: [Select]
        'xfire' => array(
            'down' => 'mem.xfire ASC',
            'up' => 'mem.xfire DESC'
        ),

Please note that those edits assume that the Xfire mod added an 'xfire' column to the members table in your database. ;)

Editing the '/Themes/{themename}/Memberlist.template.php' file:

Do a search for this code:
Code: [Select]
            <td class="windowbg2">', $member['icq']['link'], '</td>
            <td class="windowbg2">', $member['aim']['link'], '</td>
            <td class="windowbg2">', $member['yim']['link'], '</td>
            <td class="windowbg2">', $member['msn']['link'], '</td>

That code and the code around it, shows the actual field (the data for each member), its listed by column. If you wanted to add/remove any columns then you have to add/remove fields from that code.

Also do a search for this code, it may be higher than 12 if you have installed mods that add columns to your MemberList.
Code: [Select]
colspan="12"
You will need to change those values (there should be four) based on the number of columns that you have.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Offline Mr_JimWest

  • Semi-Newbie
  • *
  • Posts: 71
  • Gender: Male
  • http://jw-renders.com
    • JW-Renders
Re: Removing and Adding Columns In The Members List!
« Reply #3 on: October 24, 2008, 02:26:54 AM »
Thanks - am getting kinda lost in all this (its 1:30 am though)....

Ok - i think i may have to add it to the database 2!


Do you want to replace the current rank text column with graphics? - No, I would like to make a column next to it with the GFX for that rank / "position"
Which mod/mods are you using to show the bages/ranks? - no idea....all i added i think was xfire....and this Luckcharms theme!

Also, the edits below are for SMF 1.1.x, although they are very similar for SMF 2 Beta.  - I dont have the beta...and my 1.1x thing is 1.1.6

So rly i want the GFX for the ranks of all the pepl....the default star images....to be placed on the members list!  :D

Offline auss9960

  • Semi-Newbie
  • *
  • Posts: 24
Re: Removing and Adding Columns In The Members List!
« Reply #4 on: December 04, 2008, 01:08:01 AM »
Hi there,
             I have modified my SMF 1.1.7 profile page to include more specific fields such as marital status and state. I would like to include these fields (with images for the marital status) in the memberlist but have not been able to. I know how to add the required column, but how can I retrieve the information from the profila page to put into the memberlist? I know the profile page is storing the new information somewhere, but so far I have been unable to locate it, as it is not showing up with the rest of the members details in the database. Any ideas?

Paul

Offline auss9960

  • Semi-Newbie
  • *
  • Posts: 24
Adding Data to Profile & Members List!
« Reply #5 on: December 19, 2008, 09:32:12 PM »
Hi Everyone,

I have found a way to add new profile fields to the smf_members database (so that all the relevant info is stored in one location), and have included my working notes below. I have also added notes following about how to include this field in the memberlist as well, for anyone who wants to know. It's not all that hard really if you follow the steps carefully. If anyone is grateful for this info, I would appreciate any help to get my admin edit submit button operational again. See Profile.template.php attached. This became disabled after some editing (not related to the notes below):

//ADD new data fields to profile & store the data in smf_members database

<START>

//FIRST you must manually add the column you want to your database

Go to your PHP database in the smf_members table (in structure view)

Scroll down to the bottom and at the end of the field list you will see:

"ADD 1 FIELD(S)" WITH SELECTION BOXES OF WHERE YOU WANT THE FIELD TO APPEAR

Then follow each step below, changing 'test' to whatever name you labelled your field

Repeat as often as necessary for as many fields you want...


//In Sources/Profile.php
//----------------------


<search>$profile_strings = array(</search>

<add your data field:> 'test',</add>

<search>'birth_date' => empty($user_profile[$memID]['birthdate'])</search>

<add>'test' => !isset($user_profile[$memID]['test']) ? '' : $user_profile[$memID]['test'],</add>

<search>// Overwrite member settings with the ones you selected.</search>

<add to array>'test' => !isset($_POST['test']) ? '' : stripslashes($_POST['test']),</add>


//In Sources/Load.php
//-------------------


<search>if ($set == 'normal')</search>

<add your data field:> mem.test,</add>

<search>elseif ($set == 'profile')</search>

<add your data field:> mem.test,</add>

<search>// What a monstrous array...</search>

<add your data to array:>'test' => &$profile['test'],</add>


//In Themes/default/Profile.template.php
//--------------------------------------

<search>// Left hand profile column - where all the important user info is displayed.</search>

//Locate where you want your new profile item to appear:

<add your new data to display:>// Profile test
   echo   '
            <tr>
               <td><b><font size="2">Test:</font></b></td>
               <td><font size="2">', $context['member']['test'], '</font></td>
            </tr><tr>';</add>

<search>// The main Input Fields for profile</search>

//Again locate where you want your input field to appear

<add your new input field>// Test Input
   echo '
                                <tr>
               <td width="40%"><b>Test: </b></td>
               <td><input type="text" name="test" size="50" value="', $context['member']['test'], '" /></td>
            </tr>';</add>

</END>

//To add any of these new fields to the memberlist:


//In Sources/Memberlist.php
//--------------------------


<search>// Set up the columns...</search>

<add>      ),
                'test' => array(
         'label' => 'Test',
         'width' => '40'

<search>// List out the different sorting methods...</search>

<add>      ),
      'test' => array(
         'down' => 'mem.test ASC',
         'up' => 'mem.test DESC'</add>

<search>// They're searching..</search>

<add>      if (in_array('test', $_POST['fields']))
         $fields += array('test');</add>

//In Themes/default/Memberlist.template.php
//------------------------------------------


<search><td colspan="12"</search> (WHEREVER IT OCCURS, THE NUMBER 12 WILL BE DIFFERENT IF YOU HAVE MORE THAN 12 COLUMNS IN YOUR MEMBERLIST ALREADY)

<change>"12"</change> to the number of columns you need...

<search>// Assuming there are members loop through each one displaying their data.</search>

<add><td class="windowbg2">', $member['test'], '</td></add>

<search>// Display the input boxes for the form.</search>

<add><label for="fields-test"><input type="checkbox" name="fields[]" id="fields-test" value="test" class="check" />Search by Test</label></add>

For notes on how to change the 'test' field from a simple text field see Custom Profile Fields [nofollow].

Sincerely,
              Aus

Offline moonlightkisu

  • Semi-Newbie
  • *
  • Posts: 16
  • Gender: Female
  • come il chiaro di luna
Re: Removing and Adding Columns In The Members List!
« Reply #6 on: December 19, 2008, 10:38:52 PM »
I added the Gender column and avatar columns myself to my memberlist, you can see here:

http://bb.moonlightkisu.net/index.php?action=mlist [nofollow]

the "last active" is a mod. But I think it looks pretty good, except for I have to fix some errors and change the images, but other than that,  it took me a while, heh.

I'm having a problem with changing the ICQ and yahoo images to custom ones that still link to the same site. I don't mind if they are online/offine indicators, but I can't seem to make them link to the messenger sites when I change the image.
« Last Edit: December 19, 2008, 10:42:40 PM by moonlightkisu »

Offline ragnarok89

  • Newbie
  • *
  • Posts: 6
Re: Removing and Adding Columns In The Members List!
« Reply #7 on: January 23, 2009, 02:56:50 PM »
auss9960,

   Thank you so much for your post, it was very helpful. I followed your instructions to the letter, and everything works except for one item:

//In Themes/default/Profile.template.php
//--------------------------------------
<search>// Left hand profile column - where all the important user info is displayed.</search>


This does not appear in my Profile.template.php file (SMF 1.12), so I skipped this step; but as stated above, almost everything still works.

What I notice is when I open a member profile, and I look at the custom field, the box is empty - I do not see the current value. On the memberlist page, the value is displayed correctly. Any idea why the field does not show the current value on the Profile page?

Thanks,

Al