News:

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

Main Menu

Custom Page in SMF

Started by rowedf, September 24, 2007, 02:13:39 PM

Previous topic - Next topic

rowedf

Hello,

I'm using the mod that allows you to create custom fields in your profile's and I was wondering if someone could help me with creating a page that could display the persons name along with the three fields that I added ?

Thanks.

codenaught

Something like this mod? http://custom.simplemachines.org/mods/index.php?mod=331

With that you can create a php page that outputs whatever variables you tell it to output.
Dev Consultant
Former SMF Doc Coordinator

rowedf

That looks great, but I'm not really a php coder .... is this something that someone could help me with if I posted what I wanted displayed ?

jamesk

Where do you want it displayed?  In the user's profile?  In the memberlist?  Somewhere else?

rowedf

I wanted to have a page similar to the members list, so not really on a page, but it's own page.

jamesk

What you can do is (as previously mentioned) install the custom action mod:

http://custom.simplemachines.org/mods/index.php?mod=331

then, using the memberlist.template.php as a starting point, print out the fields you want.  From my memberlist.template.php which displays 2 custom fields is this:

// Assuming there are members loop through each one displaying their data.
if (!empty($context['members']))
{
foreach ($context['members'] as $member)
echo '
<tr style="text-align: center;"', empty($member['sort_letter']) ? '' : ' id="letter' . $member['sort_letter'] . '"', '>

<td class="windowbg2">', $member['options']['CP1'], '</td>
<td class="windowbg2">', $member['options']['CP2'], '</td>

<td class="windowbg2">', $member['avatar']['image'], '</td>
</tr>';
}


of which a lot was taken from this thread:

http://www.simplemachines.org/community/index.php?topic=92854.0


You probably have to know a little PHP to get it all together exactly as you want...  If not, you can always try posting in the HELP WANTED section...



codenaught

rowedf, do you still need help with this or did jamesk's reply help you resolve this?
Dev Consultant
Former SMF Doc Coordinator

champwarez

#7
I've added <td class="windowbg2">', $member['options']['CP1'], '</td> to managemembers.template.php but it doesn't work. Column displays nothing.
I think I have to add another code but what is?  :-\

Advertisement: