Welcome to Geeklog, Anonymous Friday, November 22 2024 @ 04:15 pm EST

Geeklog Forums

Reverse frontpage_options


Status: offline

ZooN

Forum User
Newbie
Registered: 11/13/03
Posts: 8
When adding a story the default value is "Show on Front page" i want to reverse that so that the default value is "Show only in Topic"
How do i do that ?!?
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
In admin/story.php,

change

Text Formatted Code
    } elseif ($mode == "edit") {
 


to

Text Formatted Code
    } elseif ($mode == "edit") {
        $A['frontpage'] = 0;
 
 Quote

Status: offline

asmaloney

Forum User
Full Member
Registered: 02/08/04
Posts: 214

...or in MySQL you can change the default for the field 'frontpage' in the gl_stories table to 0.
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Quote by asmaloney:
...or in MySQL you can change the default for the field 'frontpage' in the gl_stories table to 0.


That doesn't work. The COM_optionList function takes a parameter to tell it which value is selected, which is what I was setting above. Before I set it, it was undefined, making COM_optionList not actually set the "selected" attribute on any of the options. While it might be nice for the code to check the database and determine the default value for optionlists such as this one, it doesn't, so changing the database as you suggested won't actually change how the story editor page is built.
 Quote

Status: offline

asmaloney

Forum User
Full Member
Registered: 02/08/04
Posts: 214
Oops!

Ah. I apologise. [Slinks back to his corner.]

Thanks for the info - I'm done for the day now that I've learned my one thing. Wink
 Quote

Status: offline

Turias

Forum User
Full Member
Registered: 10/20/03
Posts: 807
Heh, it is an interesting idea, and one that makes some sense. Smile

I think, though, that users should never have to modify the structure of any of the core Geeklog tables. This would be an excellent use for some more config.php variables, though. Does anyone want to make a feature request? Mr. Green
 Quote

Status: offline

geKow

Forum User
Full Member
Registered: 01/12/03
Posts: 445
Quote by Turias: ...Does anyone want to make a feature request? Mr. Green


geKow takes his backpack and walks to the feature requester Wink

geKow
 Quote

Status: offline

ZooN

Forum User
Newbie
Registered: 11/13/03
Posts: 8
Thanks for the answer Turias :-)
 Quote

Status: offline

ckpicker

Forum User
Newbie
Registered: 07/01/03
Posts: 11
curious
Could you not just put an 'Order by' clause for the SQL that populates that drop-down? That would make 'Show in Topic' the first item, and therefore selected when a user creates a new story.

I think this would work, but I don't know how to implement it in PHP. Any help? Question
 Quote

Status: offline

ckpicker

Forum User
Newbie
Registered: 07/01/03
Posts: 11
I figured out how to do it. You need to change this code in admin/story.php:

Text Formatted Code
$story_templates->set_var('frontpage_options', COM_optionList($_TABLES['frontpagecodes'],'code,name',$A['frontpage']));

 


to this:

Text Formatted Code
$story_templates->set_var('frontpage_options', COM_optionList($_TABLES['frontpagecodes'],'code,name',$A['frontpage'],0));

 


The '0' parameter on the end of the function call defines the ORDER BY criteria for the SQL statement.
 Quote

Status: offline

ckpicker

Forum User
Newbie
Registered: 07/01/03
Posts: 11
Does anybody have any idea how I might limit the front page option to only certain topics?
 Quote

Status: offline

1000ideen

Forum User
Full Member
Registered: 08/04/03
Posts: 1298
>> limit the front page option to only certain topics<<
Or how about limiting "featured story" and "show on front page" to the root admin?
 Quote

All times are EST. The time is now 04:15 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content