File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -875,4 +875,34 @@ function writeInlineCommentOptions($comment) {
875875 echo '</div> ' ;
876876
877877 }
878+ }
879+
880+ if (!function_exists ('discussionUrl ' )) {
881+ /**
882+ * Return a URL for a discussion. This function is in here and not functions.general so that plugins can override.
883+ *
884+ * @param object|array $discussion
885+ * @param int|string $page
886+ * @param bool $withDomain
887+ * @return string
888+ */
889+ function discussionUrl ($ discussion , $ page = '' , $ withDomain = true ) {
890+ $ discussion = (object )$ discussion ;
891+ $ name = Gdn_Format::url ($ discussion ->Name );
892+
893+ // Disallow an empty name slug in discussion URLs.
894+ if (empty ($ name )) {
895+ $ name = 'x ' ;
896+ }
897+
898+ $ result = '/discussion/ ' .$ discussion ->DiscussionID .'/ ' .$ name ;
899+
900+ if ($ page ) {
901+ //if ($page > 1 || Gdn::session()->UserID) {
902+ $ result .= '/p ' .$ page ;
903+ // }
904+ }
905+
906+ return url ($ result , $ withDomain );
907+ }
878908}
You can’t perform that action at this time.
0 commit comments