Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 05:49 pm EDT

Geeklog Forums

Submit stories only in certain topics


Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
I don't understand how to do this.

Let's say I want group X to be able to post stories only in topic Y.

At first I thought I just need to give group X "edit" rights over topic Y.
But then I saw that it only meant they could edit/remove topic Y itself - it has nothing to do with topic Y's stories!
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
I see this has been discussed before.

I guess it can't be done...but shouldn't giving story rights over certain topics be one of the main reasons for permission rights in the first place?
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
I have to ask - how hard would it be to just look if user X has edit rights in a given topics?

After all, topics' read rights not only control the topics, but also influence the relationship between stories and users (as a middleman).

Why shouldn't topics' edit rights influence that relationship too?
 Quote

Status: offline

averageyoungman

Forum User
Chatty
Registered: 02/27/05
Posts: 36
Location:Brooklyn
Hi LWC,

I think that the following post is what you want: Topic Hack

This is a link to a forum post that contains a hack. What the hack does is limit the topics shown for "regular" users when they visit the story submission page. It uses a modified sql query to check for permissions and then displays which topics are "open" based on those permissions. Look at the bottom of the post. There you will find the hack in quote boxes. You need to add a custom COM_topicList function to lib-custom.php in /your geeklog version/system. Once you do that, you have to change some calls in two core files to call the custom function instead of the original COM_topicList function.

After you have changed the calls, you then need to change ownership rights to the topics you want "locked". You can do so by creating new groups for those topics, and then setting the ownership rights to the related topic to the new group you have created. The topic ownership rights are set in the topic admin page for each topic. Once you create the new group(s) they will show up in the dropdown for topic ownership rights.

The post explains all of this. But it's very important to remember the ownership rights for the topic, otherwise it won't work.

GL developers have noted that a malicious user (with knowledge of GL) could modify the vars being sent to change what topics get shown on the story submission page, but this hack works. I have used it with no problems so far.

There is also a small hack that will allow you to prevent regular logged in users from posting to the front page or featuring their story. It's a simple if{} statement that checks for group membership and formats an sql query based on that access. Let me know if you'd like to know how to do that as well.

I hope this is what you wanted.
--aym
 Quote

guest

Anonymous
Like you said, that check is done before they send the stories.
That's only for convenience. It's much more important to do it after the submission.

How hard can it be to do something like:
(sorry for the made up parameters - but I hope you get the point...)
Text Formatted Code

$cansubmit = false;
for (each group in user_groups($uid))
if (group == $topics[$tid['the group with edit rights']]) {
$cansubmit = true;
break;
}
if ($cansubmit == true)
...submit story...
else
if ($conf['storysubmission'] == 0)
$echo "Sorry, you have no permission
to submit to topic " . $topics[$tid[name]];
else {
$echo "Your story was queued for inspection by an admin.";
...send to queue...
}

 

?
 Quote

averageyoungman

Anonymous
True. It's not my hack, and from what i gathered the guy who did it was in a rush, but it works. And i suppose that before/after is a UI preference as well, considering checking before omtis a potential step from the process.

Perhaps there is a sequential or placement issue with the way the code is structured at the moment. I'm sure if you dug hacked hard enough you could rig it. I, unfortunately, don't currently have the time (nor the PHP experience) to do so. It would take me a longg time because I would be learning as i went. Please let me know if you come up with something. It surely does seem simple enough.
 Quote

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