Forum

Notifications
Clear all

How to sort stories by category on profile pages?

Algedi
(@algedi)
New Member

I'm not very good with PHP and stuff like that, but I have an archive with eFiction 3.5.1 and I was wondering if I could add something to the dropdown menu on profile pages: now I can sort stories on an author's page just alphabetically or by recent stories, but I need categories in that too. What do I have to do in order to sort stories also by category?
I'm sorry if someone has alreadey asked this question: I searched  but I couldn't find anything helpful 🙁

"Yes, now the rains weep o'er his hall and not a soul to hear" - Hear me Roar

Quote
Topic starter Posted : 04/02/2013 7:34 am
Lyndsie
(@lyndsie)
Member Moderator

I don't recall anyone asking this, at least not recently. This would require modifying the PHP files - probably user.php. I've done similar before for browse. However I think it would be slightly more difficult to pull in the categories.

I might think about doing the mod, but right now I'm on the other side of the world from home and I don't have a ton of time. If you think it might be something you can do yourself, browse.php is a good place to look at to get an idea of how it works.

ReplyQuote
Posted : 07/02/2013 8:30 am
Algedi
(@algedi)
New Member

Thank you for the answer, Lyndsie!
I'll try with user.php

"Yes, now the rains weep o'er his hall and not a soul to hear" - Hear me Roar

ReplyQuote
Topic starter Posted : 11/02/2013 3:36 pm
Algedi
(@algedi)
New Member

I tried and what I did doesn't work at all 🙁 I found the correct file (storiesby.php) but I can't add a new dropdown menu (or edit the old one) in order to sort stories by category.

"Yes, now the rains weep o'er his hall and not a soul to hear" - Hear me Roar

ReplyQuote
Topic starter Posted : 15/02/2013 9:58 pm
itanshi
(@itanshi)
Reputable Member

Man, I think I'm as eager as anyone here to see this code work. It just seems easier to rebuld it than to fix it.

Whats your site?

edit:

$sort.= "<option value="viewuser.php?".($action ? "action=".$action : "")."uid=$uid&amp;sort=update">"._MOSTRECENT."</option></select></form>";

replace with

$sort.= "<option value="viewuser.php?".($action ? "action=".$action : "")."uid=$uid&amp;sort=update">"._MOSTRECENT."</option>";

$sort.= "<option value="viewuser.php?".($action ? "action=".$action : "")."uid=$uid&amp;sort=category">Category</option></select></form>";

not a fix yet fyi, i'm looking into it. The viewuser.php file seems important. Its in the url noted above.

MyIsam, the db engine efic uses, does not accept foreign keys. So I'm not sure how to sort alphabetically, but it can easily be sorted by id number, which would mean by time entered into the db. Also _CATID needs defined in the language file. You could just replace it with hard code text though.

I realize this just displays the form, I'd need to check what file is called when the form is submitted and add code there.

Ok, I'm leaving this for the next brave soul. The form action is handled via javascript, but I did not find the appropriate function in the javascript.js file in the Includes folder. Here is the chunk from the profile page.

onchange="if(this.selectedIndex.value != 'false') document.location = document.sort.sort.options[document.sort.sort.selectedIndex].value

I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc 😀 Alpha released!

ReplyQuote
Posted : 16/02/2013 12:01 am
Share: