Ok thanks, well I’ve been going through finding templates and ways to edit the code manually to replace it with proper page layouts where necessary, and adding my own jquery validation for things I can actually catch with such validators…
But as for the author filtering thing…
I’ve made a simplified example of one thing I’m doing in attempt to get around not being able to sort natively by author (though it has some issues which I will get to):
Bear with me, as this involves a few steps…
I’ve been able to create members links to pages where channels are located, adding a url segment containing a member’s username via an sql query, like so:
<ul class="members_list">
{exp:query sql="SELECT username, screen_name FROM exp_members "}
<li>
<a href="http://{path=%27member_page/{username}%27}" title="View {screen_name}'s Page">_ {screen_name}_ </a>
</li>
{/exp:query}
</ul>
In this example, my main index is being used to display any untemplated urls, by turning off Strict URLs under Global Template Preferences. I’ve simply embedded a template into one of my content areas in the index like so:
{embed="shared/blog_post"}
In the embedded template, I’ve created a channel:entries expression, querying a channel called “blog” where members will post entries. I’ve then added basic conditionals so that this content only shows up when we’re on the on the correct URL (member_page, and not where those segments don’t exist), and I’m filtering the channel by the url segment_2 which should be the username of the member clicked from the members list created earlier, by comparing the segment to the author (for each result). (Basically everything between the main exp and if tags is just content, so don’t worry about that…)
{exp:channel:entries channel="blog" sort="desc"}
{if segment_1 AND segment_2 AND {"segment_1}" == "member_page" AND "{author}"=="{segment_2}" }
<div class="module blog article">
<div class="article_header">
{if image}
<div class="article_image">
{if image_link}
<a href="http://{image_link}" title="{title}" target="_blank" rel="noopener">_ {site_url}images/blog/_thumbnail/{image}{filename}.{extension}{/image}_ </a>
{if:else}
{site_url}images/blog/_thumbnail/{image}{filename}.{extension}{/image}
{/if}
</div>
{/if}
<div class="article_title">
<h2>
{title}
</h2>
<p> </p><h3>
{if subtitle}{subtitle}{/if}
</h3>
<p> </p><h4>
{entry_date format="%F %d %Y"}
</h4>
<p> </div><br />
</div><br />
{if body}<br />
<br />
{body}<br />
<br />
{/if}<br />
{if read_more}<br />
<div class="read_more_link"><br />
Read More<br />
</div><br />
<div class="read_more_content"><br />
<br />
{read_more}<br />
<br />
</div><br />
{/if}<br />
</div><br />
{/if}</p>
<p>{/exp:channel:entries}
The problem with this, is that I must first read in every entry for the whole blog channel (from all users) and then filter to the user in the url_segment. Aside from time and resource wastage, I am also unable to use count and result related values, since as far as the channel is aware, all entries are pulled as results.
This means that I can’t count, I can’t use no_results to create alternate text and I can’t use limits, since these will apply to ALL results PRIOR to the filter by author.
For example, exp:channel:entries sort=“desc” limit=“1” will always be blank, unless the user whose page we’re looking at happens to be the last user to make a post.
I discovered an alternative to this method, in that it’s possible to filter a channel by the ‘author_id’ “note, this is no-where near as useful as the ‘author’ name in my case, since I’m using usernames in the url_segments, not user_ids, and using author=”{username}” seems to be not working at all, even if entered manually.
HOWEVER I’ve discovered that while the user_id will work if MANUALLY ENTERED, using the url_segment variable in the entry tag to enter this value dynamically (in the case that I would be willing to change all my usernames in the url_segments to user_ids) has not worked at all.
i.e.
{exp:channel:entries channel="blog" sort="desc" author="john_doe" }
< This doesn’t work (yields all results for all members).
{exp:channel:entries channel="blog" sort="desc" author_id="1" }
< This works (yields results only for said member).
{exp:channel:entries channel="blog" sort="desc" author_id="{segment_2}" }
< This doesn’t work (yields results for all members).
Note that the ONLY WAY I could manage to get this to work DYNAMICALLY was using a further SQL Query, as below.
I wrap the channel in an sql query like so, pulling only the results for the username, where the username is equal to the url segment_2:
{exp:query sql="SELECT username, screen_name, member_id FROM exp_members WHERE username = '{segment_2}' "}
{exp:channel:entries channel="blog" sort="desc" author_id="{member_id}" }
content
{/exp:query}
{/exp:channel:entries}
This allows me to compare the author_id to the member_id, in order to dynamically filter the channel entries by author_id.
Pretty cool, right?
This seems to be working ok at this point, though I still can’t manage to get a
{if no_results} content {/if}
to fire off…. it seems to be referring to the exp:query, rather than the nested exp:channel:entries. so it’s applying the no_results variable to the query expression, and returning null, since there are results for the member query itself, just not the resulting channel:entries query against the author_id. I think there really just needs to be a native exp:channel:entries author parameter…
i.e. PLEASE IMPLEMENT THE FOLLOWING
{exp:channel:entries channel="channel_name" author="{segment_1}"}