General discussion
Custom close topic & pin topic

Is there like a way to create a custom feature for the codoforum I'm using? I want to be able to close or lock a topic if you are the author of the topic or an admin or moderator. I know this is possible, but I'm not sure what the syntax is for fetching rows in the codoforum platform. I also don't know the syntax for checking if a user has the right roles or if the current session user is the author.

For example

<?php
if($row['user_level'] == 4) {
    print('User is an admin');
}

Something along those lines would be good. If this type of customization works, I'm pretty sure you can also do it with a "pin" or "sticky" feature as well right? The reason why I say this is because I like how codoforum runs and how smooth it runs. However, since it doesn't have features like a normal forum does, it is just slightly behind generic forum platforms. Meaning like SMF, VBulletin, IP Board, .etc. They all have sticky/ pin, close/ lock options for topics.

It would be nice to have those options in the codoforum platform.

Is there like a way to create a custom feature for the codoforum I&#039;m using? I want to be able to close or lock a topic if you are the author of the topic or an admin or moderator. I know this is possible, but I&#039;m not sure what the syntax is for fetching rows in the codoforum platform. I also don&#039;t know the syntax for checking if a user has the right roles or if the current session user is the author. For example ```` &amp;lt;?php if($row[&#039;user_level&#039;] == 4) { print(&#039;User is an admin&#039;); } ```` Something along those lines would be good. If this type of customization works, I&#039;m pretty sure you can also do it with a &quot;pin&quot; or &quot;sticky&quot; feature as well right? The reason why I say this is because I like how codoforum runs and how smooth it runs. However, since it doesn&#039;t have features like a normal forum does, it is just slightly behind generic forum platforms. Meaning like SMF, VBulletin, IP Board, .etc. They all have sticky/ pin, close/ lock options for topics. It would be nice to have those options in the codoforum platform.

I want to be able to close or lock a topic if you are the author of the topic or an admin or moderator

We are planning these features in our next release.

<?php
if($row['user_level'] == 4) {
    print('User is an admin');
}

In codoforum, you can do above like this:

$user = User::get();

if($user->rid == ROLE_ADMIN) {

  print('User is an admin');
}

But, in codoforum, we normally do not use if statements based on user roles but we use permissions.
So, first create a permission:

$permission = new \CODOF\Permission\Permission();
$permission->add('lock topics', 'forum', array(
   ROLE_USER, ROLE_MODERATOR, ROLE_ADMIN
));

//first param is permission name
//second is just a category name for permissions
//third is an array specifying the roles that will have permission set as GRANTED

After, you define a permission like this, it will automatically become available in the backend for all roles as well as for every category.

Then, you can simply do:


$user = User::get();

if($user->can('lock topics')) {

 //let him lock them
}

I'm pretty sure you can also do it with a "pin" or "sticky" feature as well right?

Codoforum already supports sticky feature.

&amp;gt;I want to be able to close or lock a topic if you are the author of the topic or an admin or moderator We are planning these features in our next release. ``` &amp;lt;?php if($row[&#039;user_level&#039;] == 4) { print(&#039;User is an admin&#039;); } ``` In codoforum, you can do above like this: ``` $user = User::get(); if($user-&amp;gt;rid == ROLE_ADMIN) { print(&#039;User is an admin&#039;); } ``` But, in codoforum, we normally do not use if statements based on user roles but we use permissions. So, first create a permission: ``` $permission = new \CODOF\Permission\Permission(); $permission-&amp;gt;add(&#039;lock topics&#039;, &#039;forum&#039;, array( ROLE_USER, ROLE_MODERATOR, ROLE_ADMIN )); //first param is permission name //second is just a category name for permissions //third is an array specifying the roles that will have permission set as GRANTED ``` After, you define a permission like this, it will automatically become available in the backend for all roles as well as for every category. Then, you can simply do: ``` $user = User::get(); if($user-&amp;gt;can(&#039;lock topics&#039;)) { //let him lock them } ``` &amp;gt; I&#039;m pretty sure you can also do it with a &quot;pin&quot; or &quot;sticky&quot; feature as well right? Codoforum already supports sticky feature.
Necessity is the mother of all inventions!
edited Aug 10 '15 at 6:39 pm

We are planning these features in our next release.

Thanks. I will be looking forward to seeing what you guys will release.

But, in codoforum, we normally do not use if statements based on user roles but we use permissions.
So, first create a permission:

Would this be on the index page?

Codoforum already supports sticky feature.

I don't have the current actual official version yet because when I attempted to install it. The installation wouldn't work. So I am sticking with version 2.5 for now. That is why I haven't seen those features yet.

&amp;gt; We are planning these features in our next release. Thanks. I will be looking forward to seeing what you guys will release. &amp;gt; But, in codoforum, we normally do not use if statements based on user roles but we use permissions. So, first create a permission: Would this be on the index page? &amp;gt; Codoforum already supports sticky feature. I don&#039;t have the current actual official version yet because when I attempted to install it. The installation wouldn&#039;t work. So I am sticking with version 2.5 for now. That is why I haven&#039;t seen those features yet.
248
2
2
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft