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.

records distinct and show only one authors entries

May 31, 2011 9:02am

Subscribe [6]
  • #1 / May 31, 2011 9:02am

    Ralph Bartsch

    31 posts

    Hi,
    I just switched from custom asp solutions to use expression-engine instead and i am a bit lost.
    On a clients website there is a blogs section with available Blogger to the left and their entries to the right. Sounds simple but i can not get it to work.

    Bloggers get a login as members to a blogger group and i would prefere them connect through safecracker.

    How do i make a list of Bloggers for the left nav (a distinct selection of available entries) and how kan i make the listed entries on the right change to only show the ones from that paticular Blogger.

    regards

    Ralph

  • #2 / Jun 01, 2011 4:48am

    John Henry Donovan

    12339 posts

    Hi Ralph,

    Welcome to the forums 😊

    On a clients website there is a blogs section with available Blogger to the left and their entries to the right. Sounds simple but I can not get it to work.

    To confirm, is this something you are trying to replicate from your custom asp solution?

    How do i make a list of Bloggers for the left nav (a distinct selection of available entries) and how kan i make the listed entries on the right change to only show the ones from that paticular Blogger.

    While it would not be the most practical solution you could potentially achieve this with SafeCracker. There is an author variable in the Channel Entries tag that allows you to only show entries that an logged in author has written. Each one could link to a dynamic template with a SafeCracker form on it which would load the correct entry based on the URL

    Was there a reason you did not want to use the control panel for these users. Note with EE member groups you can fine grain control everything they see and have permission to do in the control panel if you were worried about that

  • #3 / Jun 01, 2011 6:13am

    Ralph Bartsch

    31 posts

    Hi Henry,
    Thank you for your reply, and sorry for my English, i am Swedish.

    The website is built from scratch.
    I am aware that the control panel can be tweaked, the client, because of the high volume of content providers, wants to keep options and support to the minimum, as well as keep control of the typography.

    I found a solution to the blog problem it works but is extremely messy so i would love to know how to do it properly.

    I pull all the records and then hide the ones that are written by another author, unfortunatly “tell a friend” does not work with this setup.

    http://sthlmbeer.rb-studios.se/index.php/blogg/

    1) leftnav and topmost record (the introduction of the guest blogger) is administered by one of the admins in a channel called Bloggers
    2) listing below contains the entries by the blogger in a channel called blogs.

    Bloggers connect trough safecracker.

    leftnav:

    {exp:channel:entries channel="blogger" orderby="blogger_sortorder" sort="asc" dynamic="no" }
    <li><a href="http://{site_url}index.php/blogg/{url_title}/{title}">{title}</a></li>
    {/exp:channel:entries}

    The Blogger introduction:

    {exp:channel:entries channel="blogger" url_title="{segment_2}" dynamic="no" limit="1" orderby="blogger_sortorder" sort="asc"}

    The actual Bloggs:

    {exp:channel:entries channel="blogg"  orderedby="date" dynamic="no"  }
    {if author == "{segment_3}" }

    I now need a solution for a similar problem, the exhibitors to the fair are supposed to administer their own entries, several hundreds of exhibitors with several hundreds of products each.
    Exhibitor information and listing of products
    I have no problem displaying this in the admin (safecracker), but how do i get this information to the frontpage?
    how do i limit listings based on author_id or similar?

    regards

    Ralph Bartsch

    ps. the client has had problems previous years due to high volume of visitors, your EngineHosting does seem tempting but as a we are in a diffrent timezone, what are the support hours. ds

  • #4 / Jun 01, 2011 3:28pm

    Brandon Jones

    5500 posts

    Hi Ralph,

    Take a look at the author_id parameter of the channel entries tag, particularly the special “CURRENT_USER” variable.

    SafeCracker also has an author_only parameter that will limit editing ability to the entry’s author only (well, and Superadmins).

    Does that help?

  • #5 / Jun 02, 2011 4:27am

    Ralph Bartsch

    31 posts

    Not really, the purpose for writing the blog in the first place is for others th be able to read it 😊

    I am not explaining this well!

    Backend is running perfectly using safecracker both for the exhibitors and for the bloggers.

    my problem is the front end.

    1) top of page introduction to the in the left nav selected blogger (author_id=1)
    2) left of page list of available bloggers (author_id=1)
    3) right of page a list of bloggentries made by the blogger selected on the left (author_id=56 or 23 or 76 etc)

    since i cannot limit the channel with author(of bloggentries)=title(blogger) i have to load them all and then not diplay them with an if statement.

  • #6 / Jun 02, 2011 3:19pm

    Sue Crocker

    26054 posts

    Hi, Ralph. What does the url look like?

    Or what do you have for the link of available bloggers? Where do those links go?

  • #7 / Jun 03, 2011 5:24am

    Ralph Bartsch

    31 posts

    Hi Sue,

    First of all, thank you Sue for your posts about safecracker, without the help and examples you have given here on the forum (albeit to others) I would not have picked up safecracker and its usage so fast, i have read so many of your posts it feels like i am writing to a celebrity. :red:

    —-
    One of the admins enters a short bio of the Blogger into the channel “Blogger”, creates a membership also"Blogger” and instructs the Blogger to a safecracker page where the blogger can submit bloggs into channel “Bloggs”. Since i cant use {author} or {author_id} to limit the searches i am using {title} as {url_title} to limit the search in the two channels.
    I did try earlier to keep all the data in the same channel, but could not find a way to create a Distinct list of Bloggers.
    Also the tell a friend does not work in the current set up.

    Since i not very good at explaining myself i attach a screenshot and the code


    regards

    Ralph Bartsch

    <!DOCTYPE HTML>
    <html>
    {embed="includes/page_header"}
    <body>
    <div class="container_16" id="container">
    <!--   header   -->
    {embed="includes/body_header"}
    <!--   end header   -->
    <!--   content     -->
    <div id="content" class="clearfix">
    
    <div id="content_right">
    <!--  start blogger  -->
    {exp:channel:entries channel="blogger" url_title="{segment_2}" dynamic="no" limit="1" orderby="blogger_sortorder" sort="asc"}
    <div id="content_intro">
    <div class="grid_8"><h1>{blogger_header}</h1>{blogger_body}</div>
    <div class="grid_4" id="content_intro_image">{if blogger_image !=""}{blogger_image}{if:else}{site_url}images/image_missing_220x190{/if}</div>
    <div class="grid_12">{site_url}images/line.png</div>
    <div class="clear"></div>
    </div>
    {/exp:channel:entries}
    <!--  end blogger  -->
    <!--  start list of blogg --> 
    {exp:channel:entries channel="blogg"  orderedby="date" dynamic="no"  }
    {if author == "{segment_3}" }
    <div class="content_blogg">
    <div class="grid_4">{blogg_image}</div>
    <div class="grid_8"><span class="date">{entry_date format="%Y %m %d"}</span><h1>{blogg_header}</h1>{blogg_body}
    </div>
    <div class="grid_12">{site_url}images/line.png</div>
    <div class="clear"></div>
    </div>
    {/if}
    {/exp:channel:entries}
    <!--end list of bloggs-->
    </div>
    <!--left nav --> 
    <div id="content_left">
    <div class="grid_4">
    <div class="leftcol_header">BLOGGAR</div>
    <div class="leftcol_links">
    <ul>
    {exp:channel:entries channel="blogger" orderby="blogger_sortorder" sort="asc" dynamic="no" }
    <li><a href="http://{site_url}index.php/blogg/{url_title}/{title}">{title}</a></li>
    {/exp:channel:entries}
    </ul>
    </div>
    </div>
    </div>
    <!--end left nav --> 
    </div>
    <div class="clear"></div>
    <!--   footer   -->  
    {embed="includes/page_footer"}
    <!--   end footer   --> 
    </div>
    </body>
    </html>
  • #8 / Jun 03, 2011 6:04pm

    Kevin Smith

    4784 posts

    Hey Ralph–

    Let me see if I understand you correctly: On the left side, you’d like to list the bloggers (authors) in the left navigation. On the right side of the page, you want to list the selected author’s name, bio, and photo at the top of the page, along with a list of his/her most recent entries sorted by date, correct?

    I think there may be an easier way to handle this. Right now, to store your author information (name, bio, photo), you’re using channel entries. It would make more sense to use the existing member profile fields for each of your blogger members to store this information. Is there a reason you can’t do this?

    The reason I suggest this is that it gives you much better data on the authors with which you can show and sort entries.

    To list your bloggers, you can use a plugin like AC Member list with its group_id parameter, and link instead to:

    {site_url}index.php/blogg/{member_id}

    This way, you can pull your author name, bio, and photo using either the Custom Profile Data Tag or AC Member list. Both allow you to use member_id as a parameter.

    So your author information block would then look something like this:

    {exp:member:custom_profile_data member_id="{segment_2}"}
    <div id="content_intro">
    <div class="grid_8"><h1>{screen_name}</h1>{bio}</div>
    <div class="grid_4" id="content_intro_image">{if photo}{photo_url}{if:else}{site_url}images/image_missing_220x190{/if}</div>
    <div class="grid_12">{site_url}images/line.png</div>
    <div class="clear"></div>
    </div>
    {/exp:member:custom_profile_data}

    And your author’s entries could be filtered easily enough by adding the author_id parameter to your channel entries tag like so:

    {exp:channel:entries channel="blogg" author_id="{segment_2}" orderedby="date" dynamic="no"}

    Does that help simplify things a bit?

    Kevin

  • #9 / Jun 04, 2011 10:17am

    Ralph Bartsch

    31 posts

    Hi Kevin,

    A different approach but the results are exactly what i need.
    Thank you Kevin! thank you so much.

    regards


    Ralph

  • #10 / Jun 05, 2011 4:44pm

    Greg Salt

    3988 posts

    Hi Ralph,

    Glad that Kevin was able to sort this out for you. Please post again if you have further questions or problems.

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases