Welcome to Geeklog, Anonymous Saturday, April 13 2024 @ 06:10 pm EDT

Geeklog Forums

"postmodes" mysql table / COM_optionsList


Status: offline

averageyoungman

Forum User
Chatty
Registered: 02/27/05
Posts: 36
Location:Brooklyn
praying it will work Hello,

I would like to limit "standard" logged in users from posting to the front page or featuring their story. I already have a hack in place which "locks" certain topics based on group membership. I will do a similar check to allow/forbid users from posting stories on the front page.

So, what I am attempting to do is find exactly where the "Show on front page" etc. originate from. I have been attempting to alter the COM_optionsList function to do so, but I can't find exactly where those particular values are I have used echo to see what the values are as the $retval is being concatenated, so I know they are there, but I don't know in what portion of the "for" loop they are retrieved in.

I realize that the $A[1] variable has the string with those values, but I can't find them in the database either. The gl_postmodes table contains only the actual postmodes and not the options for the post, so I am perplexed as to where these values are coming from. I'm sure there is something I am missing but I am relatively new to both PHP and MySql so any help would be awesome. I would really like to create separate "spaces" for loggged in users/admins.

site is : Blogmental

Thank you,

--aym
--aym
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
COM_optionList is just a general function that pulls (value, name) pairs out of the database and displays them in a dropdown menu.

In case of the "postmode" table, if you check that table in the database, you'll see that it has a code ('plaintext', 'html') and a name ('Plain Old Text', 'HTML Formatted') column. The name is what the user sees and the code is what Geeklog uses internally (and stores in the stories table, for example).

You could add other (code, name) pairs if you wanted (and provided the code to handle them). And if you want to restrict the options, you should provide a "where" clause to the COM_optionList call (last parameter).

Don't modify the function itself - it's being called from other places as well.

Hope that helps.

bye, Dirk
 Quote

Status: offline

averageyoungman

Forum User
Chatty
Registered: 02/27/05
Posts: 36
Location:Brooklyn
Arrow Ok. I found where they are in the gl_tables: gl_frontpagecodes and gl_featurecodes. I am making an assumption by looking at the generated source for my page that the "0" and "1" values are used to determine which is the default selection, but what I need to do for non-admin users is remove those options from the submit story page.

I will hack away and see if I can pinpoint which function in the series of calls is actually retrieving these values so I can determine the best way to alter the final $retval in this case, but any help would be greatly appreciated.

Thanks again,

--aym
--aym
 Quote

Status: offline

averageyoungman

Forum User
Chatty
Registered: 02/27/05
Posts: 36
Location:Brooklyn
Thanks Dirk! Got that last post up before I saw the response. I will use the information and see if I can't implement something a little cleaner.

Please bear with me, I'm new to this stuff.

Just to confirm : I am under the impression that the specific call I am trying to manipulate is being done on line 365 of submit.php. And based on that I assume that I would add the extra "where" to the query there. Correct? Currently it appears that the call is beingg done with only the $table, $selection and $selected parameters.

And...

I was going to base the "front page access" condition on whether the user is a member of the "Root" group. Would this be a good way to accomplish this, or does there exist a better or easier way? I'd rather stick to something closer to a developer implementation if possible.

Thanks for the forewarning regarding the function. I really appreciate the help.

--aym


--aym
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by averageyoungman: Just to confirm : I am under the impression that the specific call I am trying to manipulate is being done on line 365 of submit.php. And based on that I assume that I would add the extra "where" to the query there. Correct? Currently it appears that the call is beingg done with only the $table, $selection and $selected parameters.

It's line 361 in the submit.php from Geeklog 1.3.11, but otherwise correct.

Quote by averageyoungman: I was going to base the "front page access" condition on whether the user is a member of the "Root" group. Would this be a good way to accomplish this, or does there exist a better or easier way?

Users of the Root group will be redirected to admin/story.php automatically, so you have to make the changes there as well.

Also, anything story-related should really be based on the story.xxx features, so I'd suggest to use the Story Admin group instead or create a new feature for it and base your decision on whether the current user has that feature or not.

bye, Dirk
 Quote

Status: offline

averageyoungman

Forum User
Chatty
Registered: 02/27/05
Posts: 36
Location:Brooklyn
Thanks again.

Sorry to bug you but... Shocked

One thing I'd like to understand. I've littered my desktop with open files but can't seem to find a direct reference.

The code on line 361 (mine is lower down, due to some commenting) appears to be calling COM_optionList with only a request for data from the gl_postmodes table, yet if I take a look at the $sql var for the query in COM_optionList, it has multiple "SELECT" declarations for multiple tables. My confusion lies in where the other individual table queries are being added, and i'd like to understand it simply so I don't feel like I'm walking on eggshells. I've tracked down the functions that do the actual DB query, and I can't seem to find a direct reference. I also don't see any extra query code in the "submitstory" function in submit.php, or added to the $A[] array in that same function. Is the COM_optionsList function being called recursively? Really, I just want to make sure I have a clear understanding before I add to the code.

Sorry for my confusion. Want to make sure I don't hack myself into a broken blog.

Thanks,

--aym
--aym
 Quote

Status: offline

averageyoungman

Forum User
Chatty
Registered: 02/27/05
Posts: 36
Location:Brooklyn
Ok. I managed to pull my head out of my butt long enough to realize that the calls to COM_optionsList for the "frontpagecodes" are being made in admin/story.php.

Thanks a ton for your time and for helping make my site functional the way I want it!

--aym
--aym
 Quote

All times are EDT. The time is now 06:10 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