Disable Edit-Function in one Group (hardcoded)

Claus Lampert Posted in Technical Support 9 years ago

I would like to disable the edit-function (postings only, commentary doesn´t matter) in one of my groups (for example group 001).
The function could be hardcoded and there need not to be a difference between users and admins.

I think I have to change something in components/ossnwall/ossn_com.php at line 251ff case 'edit' but don´s know how to read the group number.

if($post->poster_guid == $user->guid || $user->canModerate()) {

Replies
German Claus Lampert Replied 9 years ago

Finally, I think the group-number is $post > owner_guid:

This works for me:
$post = ossngetobject($pages[1]);
if($post->type = "group"){
if($post->owner_guid == xxx) // xxx = group-id
{ }
}

Thank you for your help!

Indonesian Arsalan Shah Replied 9 years ago

You can get something like this:

 $post = ossn_get_object($pages[1]);
 if($post->type = 'group'){
    if($post->guid == xxxx){

       }
   }
German Claus Lampert Replied 9 years ago

if($owner == yougroupid){
redirect(REF);
}
As I understand, this line will only allow the group-owner to post a message. That´s not what I mean, sorry!

Example: I am the owner of the group "Prediction" (for example groupid = 1)
Now the User -1-, User -2-, User -3- and so on can post a prediction to the wall. But the users are not allowed to change their prediction/post afterwards. The edit function should be disabled.

The script should be something like this:

components/ossnwall/ossn_com.php at line 251ff

if($post->poster_guid == $user->guid || $user->canModerate()) {
if ( *groupid* == "1")
{return; // leave edit-function}

Now I need to know how to get the groupid

Indonesian Arsalan Shah Replied 9 years ago

Please see: \components\OssnWall\actions\wall\post\group.php

You need to add code something like,

if($owner == yougroupid){ 
    redirect(REF);
}
German Claus Lampert Replied 9 years ago

Arsalan Sha: exactly. It´s for a kind of game where the users have to leave a prediction (stock market quotes). And there should be no possibility to change an entry afterwards.

Indonesian Arsalan Shah Replied 9 years ago

Do you wanted to disable post editing for certain group?

German Claus Lampert Replied 9 years ago

P.S. there is no need of an error-Message for the user. The users of this group will know that there is no possibility to edit a postings.