ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

create a stand-alone profile page

February 18, 2008 9:46am

Subscribe [6]
  • #1 / Feb 18, 2008 9:46am

    Kerim Satirli

    52 posts

    as the title suggests, I am trying to build a stand-alone profile page that shows all custom fields as well as email, links to recent entries / comments of the user and all.

    I found one solution which involves setting up another weblog and while that is a good fallback, I would very much like to simply build a page with some variables on it and then have EE popupalte it with database values.

    The user would be passed to the script via segment_3 and would be a name instead of an ID (such as the official member profile does)

    I could probably do this with the query templates and a number of SQL queries, but I am hoping that there is some other solution, that I simply have not yet found.

    P.S.: I do realize that the normal member templates can do most of this, but I am still gunning for a stand-alone profile page.

    thoughts?

  • #2 / Feb 18, 2008 12:58pm

    Robin Sowell

    13255 posts

    Yep- I’ve done it with queries.

    {exp:query sql="SELECT m.*, d.* FROM exp_members m,  exp_member_data d WHERE m.group_id != 50 AND username='{segment_2}' AND m.member_id = d.member_id"}
    <h4>About</h4>
    <p><a href="http://{path=" class="blogAuthor">{screen_name}</a></p>
    
    <p>{if m_field_id_1}{m_field_id_1}<br />
    {/if}<br />
    {if m_field_id_2}{m_field_id_2}<br />
    {/if}<br />
    {if m_field_id_3}{m_field_id_3}<br />
    {/if}<br />
    <a href="http://{path=" class="blogLink">[Send a message]</a></p>
    
    <p>{if photo_filename != ""}http://www.godspy.com/images/member_photos/{photo_filename}<br />
    {/if}</p>
    
    <p>{exp:char_limit total="200"}{exp:html_strip}{bio}{/exp:html_strip}{/exp:char_limit}</p>
    
    <p><a href="http://{path=" class="blogLink">[View entire profile]</a></p>
    
    
    
    <p>{/exp:query} </p>
    
    <p><br />
    {exp:query sql="SELECT url_title, title, comment, t.weblog_id AS web_id FROM exp_comments c, exp_weblog_titles t WHERE c.author_id = '<?php echo $id; ?>' AND c.entry_id = t.entry_id AND t.status!= 'closed' LIMIT 3"}<br />
    {if count == 1}</p><h4>Latest Comments</h4><p>{/if}</p>
    
    <p>RE: {if web_id == "2"}<a href="http://{path=" class="relatedLink">{title}</a><br />
    {if:elseif web_id == "3"}<a href="http://{path=" class="relatedLink">{title}</a><br />
    {/if}    <br />
                <br />
    {comment}<br />
    {if count == "3"}<a href="http://{path=" class="blogLink">[View all comments]</a>{/if}<br />
    {/exp:query}

    Etc…  It’s the easiest, most flexible way I know to do it.

  • #3 / Feb 18, 2008 2:48pm

    Joobs

    362 posts

    I’m currently expereimenting with this.

    You might want to look at Solspace’s User Module.  Give you a little bit more flexibility that just using queries to pull member information.

    The other option is to use a weblog to store profile information, this will allow you to do standard weblog things in profiles like comments or tags.  TonyNibbles posted an extension for the User module which automatically creates a weblog when someone registers (i’ve had trouble getting it to work). With some modification you could alter it so it creates a weblog when the user activates their account or logs in etc (think there are extension hooks for those).

  • #4 / Feb 18, 2008 4:03pm

    Kerim Satirli

    52 posts

    Robin:

    thank you very much; this is just what I needed and it is working perfectly 😊

    Joobs:

    thanks for your suggestion, the User Module looks to be quite nice but a tad on the expensive side for what I am doing 😊

  • #5 / Aug 08, 2008 12:19pm

    kelseyads2

    98 posts

    I just wanted to thank you for posting this code. We’re rebuilding our company website in EE, and this kept us from having to create a new weblog for “people.” I didn’t want to use the member profiles because we’re really just putting a photo, email link and bio up for each employee. This is a simple, elegant way to do that with just a template.

  • #6 / Aug 08, 2008 12:25pm

    Sacha

    33 posts

    I’m using this code too, and it’s a nice solution. The only thing I did different is that I wrote the select like this: SELECT m_field_id_1 as name, m_field_id_2 as email so that I can use {name} and {email} later in my template instead of {m_field_id_1} which is not very descriptive.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases