Simple Machines Community Forum

General Community => Scripting Help => Topic started by: rowedf on September 24, 2007, 02:13:39 PM

Title: Custom Page in SMF
Post by: rowedf on September 24, 2007, 02:13:39 PM
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.
Title: Re: Custom Page in SMF
Post by: codenaught on September 24, 2007, 07:07:41 PM
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.
Title: Re: Custom Page in SMF
Post by: rowedf on September 25, 2007, 11:53:57 AM
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 ?
Title: Re: Custom Page in SMF
Post by: jamesk on September 25, 2007, 01:42:20 PM
Where do you want it displayed?  In the user's profile?  In the memberlist?  Somewhere else?
Title: Re: Custom Page in SMF
Post by: rowedf on September 25, 2007, 04:26:02 PM
I wanted to have a page similar to the members list, so not really on a page, but it's own page.
Title: Re: Custom Page in SMF
Post by: jamesk on September 25, 2007, 07:37:51 PM
What you can do is (as previously mentioned) install the custom action mod:

http://custom.simplemachines.org/mods/index.php?mod=331 (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 (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...


Title: Re: Custom Page in SMF
Post by: codenaught on October 21, 2007, 12:53:02 PM
rowedf, do you still need help with this or did jamesk's reply help you resolve this?
Title: Re: Custom Page in SMF
Post by: champwarez on November 08, 2007, 01:02:06 PM
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?  :-\