Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ function sc_search($parm=null)
}


function sc_perms()
function sc_perms($parm=null)
{
global $forum, $forumId;

Expand All @@ -347,9 +347,14 @@ function sc_perms()
$permDisplay['edit'] = LAN_FORUM_0048;
}
--*/
if(!empty($parm['type']))
{
return 'alert alert-'.($forum->checkPerm($forumId, 'post')?'info':'danger');
}

return implode("<span class='forum-perms-separator'><!-- --></span>", $permDisplay);

global $FORUM_VIEWFORUM_TEMPLATE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using global is very PHP5. Please load the template. It can be done in the construct()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the way the forum code is written. The template is already loaded in the main forum_view.php code, and for me it was a overload to load the template twice...
There's another way to do it. Pass the template via sc var, but that would require rewrite the main php file code....
Anyway all the forum code needs a major rewrite, it's poorly programmed...

If i'm allowed, i can do it...

Copy link
Member

@Moc Moc Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, for quite some time I've been considering a rewrite from scratch of the forum plugin but while still keeping the same database structure.

We could start a rewrite as a new plugin in a separate repository. Then at some point it can be merged into core.

// return implode("<span class='forum-perms-separator'><!-- --></span>", $permDisplay);
return implode($FORUM_VIEWFORUM_TEMPLATE['perms_separator']?:"<span class='forum-perms-separator'><!-- --></span>", $permDisplay);
}

function sc_forumjump()
Expand Down
2 changes: 1 addition & 1 deletion e107_plugins/forum/templates/forum_viewforum_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@

// $FORUM_VIEWFORUM_WRAPPER['THREADNAME'] = "<span class='label label-info'>{---}</span>";


$FORUM_VIEWFORUM_TEMPLATE['perms_separator'] = "<span class='forum-perms-separator'><!-- --></span>";



Loading