Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: rcane on September 28, 2024, 02:48:02 PM

Title: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on September 28, 2024, 02:48:02 PM
I've got some custom "profile" pages to get away from the SMF additional profile fields.  Mine is more of a dashboard for the Global Mods to glean specific info about a member.

The admin > members > view all members table has a wonderful col 1 (ID) where the id_member is displayed.

I wanted to get an <a href> on that to direct to the custom page, but for the life of me I can't figure out which template has this table.

I tried Themes/my_current_theme/memberlist.template.php  to simply tuck a div in there that would let me know I'm on the right page, but I can't seem to find it.

echo '<div style="color: red; font-size: 40px; font-weight: bold;">IS THIS THE RIGHT FILE?</div>';

I tried that at the top of the page as well as inside template_main().

no joy.

I tried the template in core and default as well.   Killed caches and such too. 

So,

It makes me think this is NOT the place to see that html table get presented (to make my addition).

memberlist.php seems to only handle the setup but not the payoff.

Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: Aleksi "Lex" Kilpinen on September 28, 2024, 03:03:51 PM
Perhaps look at ManageMembers.template.php
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on September 28, 2024, 03:05:56 PM
Quote from: Aleksi "Lex" Kilpinen on September 28, 2024, 03:03:51 PMPerhaps look at ManageMembers.template.php

"that is the most outstanding answer I've ever heard in my entire life"

I'd been focusing on the wrong file name.

Though i'm still having at time backtracking the html table.

Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: Illori on September 28, 2024, 03:47:54 PM
might help you to add $db_show_debug = true; to your Settings.php file when you need to, so you can find out the files loaded on certain pages. remove it when you are done.

this enables a feature at the footer of the page to show more "stuff".
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on September 28, 2024, 03:52:47 PM
Quote from: Illori on September 28, 2024, 03:47:54 PMmight help you to add $db_show_debug = true; to your Settings.php file when you need to, so you can find out the files loaded on certain pages. remove it when you are done.

this enables a feature at the footer of the page to show more "stuff".

oh that's nice.   thank you.


managemembers.template.php seems to only handle the search / awaiting activation / awaiting approval.   the view all members html table generation is pretty elusive.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: GL700Wing on September 29, 2024, 01:21:35 AM
Quote from: rcane on September 28, 2024, 02:48:02 PMI've got some custom "profile" pages to get away from the SMF additional profile fields.  Mine is more of a dashboard for the Global Mods to glean specific info about a member.

The admin > members > view all members table has a wonderful col 1 (ID) where the id_member is displayed.

I wanted to get an <a href> on that to direct to the custom page, but for the life of me I can't figure out which template has this table.
The Custom Fields On Memberlist (https://custom.simplemachines.org/index.php?mod=1520) mod might do what you want ...
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on October 01, 2024, 09:55:59 PM
Well, I'm happy with the 'view all members' page in SMF actually.  But, I've been trying to find where the ID # is output to the html table. 

In the template files and such I can find the search button results, activation results, etc, but the general "all members" html that shows ID/username, email, etc is eluding me.

Specially, the ID col.  Just where is that easter egg hidden?

Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: GL700Wing on October 02, 2024, 12:57:57 AM
The information is in the $context['member'] array in the memberlist template file:

The following command will get the list of member IDs:
$memberIDs = array_column($context['members'], 'id');
The following command will sort the list of members IDs in ascending order:
sort($memberIDs);
The output will look similar to the following:
array(4) {
  [0]=>
  string(1) "1"
  [1]=>
  string(1) "2"
  [2]=>
  string(1) "3"
  [3]=>
  string(1) "5"
}


Alternatively if you want to generate the same sorted list of member IDs in any script/template file you can use the following code:
global $smcFunc;
$result = $smcFunc['db_query']('', '
SELECT id_member
FROM {db_prefix}members
WHERE is_activated = {int:is_activated}
ORDER BY id_member',
array('is_activated' => 1)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
$memberIDs[] = $row['id_member'];
$smcFunc['db_free_result']($result);
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on October 02, 2024, 08:10:28 AM
Quote from: GL700Wing on October 02, 2024, 12:57:57 AMThe information is in the $context['member'] array in the memberlist template file:

The following command will get the list of member IDs:
$memberIDs = array_column($context['members'], 'id');
The following command will sort the list of members IDs in ascending order:
sort($memberIDs);
The output will look similar to the following:
array(4) {
  [0]=>
  string(1) "1"
  [1]=>
  string(1) "2"
  [2]=>
  string(1) "3"
  [3]=>
  string(1) "5"
}


Alternatively if you want to generate the same sorted list of member IDs in any script/template file you can use the following code:
global $smcFunc;
$result = $smcFunc['db_query']('', '
SELECT id_member
FROM {db_prefix}members
WHERE is_activated = {int:is_activated}
ORDER BY id_member',
array('is_activated' => 1)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
$memberIDs[] = $row['id_member'];
$smcFunc['db_free_result']($result);


Can you reference my attached image on the last post?    if you click the 'view all members' button you get a nice table.   I'm trying to zero in on where col 1 (ID) is displayed?   The 'id' there seems to be just a static <td> data.

id, username, display name, email, ip, last online, posts, then a checkbox. 

i thought it was memberlist.template.php but i'm not so sure now.
   
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: GL700Wing on October 02, 2024, 08:24:30 AM
Quote from: rcane on October 02, 2024, 08:10:28 AMI'm trying to zero in on where col 1 (ID) is displayed? 
The member ID is displayed in 'Administration Center » Members » View All Members' memberlist.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on October 02, 2024, 08:27:31 AM
Yes,
Quote from: GL700Wing on October 02, 2024, 08:24:30 AM
Quote from: rcane on October 02, 2024, 08:10:28 AMI'm trying to zero in on where col 1 (ID) is displayed? 
The member ID is displayed in 'Administration Center » Members » View All Members' memberlist.

Correct.  I am looking to see WHERE in the template.php it is displayed--not the admin user interface.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: Illori on October 02, 2024, 08:29:57 AM
looks like this table is generated in Sources/ManageMembers.php around line 455.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on October 02, 2024, 08:41:06 AM
Quote from: Illori on October 02, 2024, 08:29:57 AMlooks like this table is generated in Sources/ManageMembers.php around line 455.

yeah, that seems like the Column header.  I was able to test that.  Still looking for where the actual _members records are displayed in their own <td></td>.  Since the ID numbers in column 1 of admin/members/view all members is just dead text I wanted to a an onclick or href (not sure yet).  I was hoping to just catch it at table row propagation.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: Illori on October 02, 2024, 08:45:31 AM
require_once($sourcedir . '/Subs-List.php');
createList($listOptions);

it is not just defined for this section, it is for all of these lists.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on October 02, 2024, 08:52:10 AM
Quote from: Illori on October 02, 2024, 08:45:31 AMrequire_once($sourcedir . '/Subs-List.php');
createList($listOptions);

it is not just defined for this section, it is for all of these lists.

One large list that gets parsed for the different areas of SMF?  That makes sense.  I was hoping to use the search page there to find someone, then hyper off their ID to a custom page to review some data about them. 

Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: Illori on October 02, 2024, 08:54:07 AM
that would be done in the ManageMembers.php file, not the actual file that creates the table if i understand what you want to do correctly.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on October 02, 2024, 08:57:58 AM
I might find another place to do this, but if you go up to post #6 i have an image attached. 

col 1 is ID.   just wanted to hijack that id_member to open a page for any given person.  just a ../custom/test.php?id_member   <-- in the spirit of that.
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: Illori on October 02, 2024, 09:16:38 AM
'columns' => array(
'id_member' => array(
'header' => array(
'value' => $txt['member_id'],
),
'data' => array(
'db' => 'id_member',
'class' => 'windowbg',
'style' => 'text-align: center;',
),
'sort' => array(
'default' => 'id_member',
'reverse' => 'id_member DESC',
),
),

then look into this part.

similar to what was done here

'display_name' => array(
'header' => array(
'value' => $txt['display_name'],
),
'data' => array(
'sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'real_name' => false,
),
),
),
'sort' => array(
'default' => 'real_name',
'reverse' => 'real_name DESC',
),
),
Title: Re: Can someone help me determine if memberlist.template.php is what I seek?
Post by: rcane on October 02, 2024, 10:02:17 AM
Quote from: Illori on October 02, 2024, 09:16:38 AM 'columns' => array(
'id_member' => array(
'header' => array(
'value' => $txt['member_id'],
),
'data' => array(
'db' => 'id_member',
'class' => 'windowbg',
'style' => 'text-align: center;',
),
'sort' => array(
'default' => 'id_member',
'reverse' => 'id_member DESC',
),
),

then look into this part.

similar to what was done here

'display_name' => array(
'header' => array(
'value' => $txt['display_name'],
),
'data' => array(
'sprintf' => array(
'format' => '<a href="' . strtr($scripturl, array('%' => '%%')) . '?action=profile;u=%1$d">%2$s</a>',
'params' => array(
'id_member' => false,
'real_name' => false,
),
),
),
'sort' => array(
'default' => 'real_name',
'reverse' => 'real_name DESC',
),
),




*raises a glass to you for this one*