Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 07:30 am EDT

Geeklog Forums

Images & Queue for User-Stories - Function questions


Status: offline

Svobi

Forum User
Newbie
Registered: 05/31/05
Posts: 2
confused
Hi!

Since no one responded so far on my other try here I spent several hours on another way to give my users the chance to submit articles with images, introtext, bodytext AND submission queue.

First I created a new group "article posters" and granted them story.edit and story.submit rights.

Now I can put in normal users into that group and they can send articles like admins. Which is kinda nice but I want to have the queue where I must agree to publish. Additionally I don't want these public story posters to have every option available from the admin-editor.

Now into teh code:

- I dublicated the admin storyeditor.thtml to storyeditor1.thtml

- Changes in the admin file story.php:

1) "function storyeditor" (to give the group members an own editor template) ->

Text Formatted Code

{
        $story_templates->set_file(array('editor'=>'storyeditor.thtml'));
}

 


to

Text Formatted Code

if (isset ($_GROUPS['article posters'])) {
            $story_templates->set_file(array('editor'=>'storyeditor1.thtml'));
        } else {
            $story_templates->set_file(array('editor'=>'storyeditor.thtml'));
}
 


This one checks the group. If the submitter belongs to my new group he get's the storyeditor1.thtml template for his editor. I can modify this to hide & cut out unwanted features, to let it look like more the public one.

WORKS GREAT - CHEERS! Laughing

2) "function submitstory" (to enable the queue thinggy) ->

- added "$_GROUPS" to global that it looks like this:

Text Formatted Code
global $_CONF, $_TABLES, $_USER, $LANG24, $MESSAGE, $_GROUPS;
 



- exchanged

Text Formatted Code

DB_save ($_TABLES['stories'], 'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,expire,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,show_topic_icon', "'$sid',$uid,'$tid','$title','$introtext','$bodytext',$hits,FROM_UNIXTIME($unixdate),'$comments','$related',$featured,'$commentcode','$statuscode','$expire','$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon");

 


with

Text Formatted Code

    if (isset ($_GROUPS['article posters'])) {
        DB_save ($_TABLES['storysubmission'],
            'sid,tid,uid,title,introtext,bodytext,date,postmode',
            "'$sid','$tid',$uid,'$title','$introtext','$bodytext',NOW(),'$postmode'");
    } else {
        DB_save ($_TABLES['stories'], 'sid,uid,tid,title,introtext,bodytext,hits,date,comments,related,featured,commentcode,statuscode,expire,postmode,frontpage,draft_flag,numemails,owner_id,group_id,perm_owner,perm_group,perm_members,perm_anon,show_topic_icon', "'$sid',$uid,'$tid','$title','$introtext','$bodytext',$hits,FROM_UNIXTIME($unixdate),'$comments','$related',$featured,'$commentcode','$statuscode','$expire','$postmode','$frontpage',$draft_flag,$numemails,$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon,$show_topic_icon");
}

 


This should save the written article to "storysubmission" for queue reasons if the user belongs to teh new group and if he doesn't: Post story immediately like usual.

->>> This fails since the "if (isset ($_GROUPS['article posters']))" doesn't work here in this function!! And I've got no idea why. The $_GROUPS is defined in teh libcommon. I tried to juggle with several code pieces, but doesn't help. No idea. The function only ends up in the "else" state: When I put the first DB_save into teh else code it work's perfect and the article is posted into the submission queue.

Question 1: What must I do to make that $_GROUPS work in the second function??

I encountered another problem with this new group. Since I'm as a root-group-user belong to this new group as well, my stories end up in queue mode and stripped editor as well, which isn't very nice. I can temporarely fix this while creating a pseudo-spare-root-user and take root-rights away from myself but that isn't really handy.

Question 2: What must I do to take myself out of a self-created group which I automaticly belong to as a root-group-user?

Thanks for every hint and tip!

Cheers - Svobi
 Quote

All times are EDT. The time is now 07:30 am.

  • 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