Is the delete feature gone?

7 Replies, 187 Views

Not seeing it as an option anymore?
'Historically, we may regard materialism as a system of dogma set up to combat orthodox dogma...Accordingly we find that, as ancient orthodoxies disintegrate, materialism more and more gives way to scepticism.'

- Bertrand Russell


[-] The following 1 user Likes Sciborg_S_Patel's post:
  • Laird
I haven't deliberately changed anything, and none of the other admins are active so they wouldn't have either, so I don't know what's going on there. We did a while back disable the deleting of threads just because we didn't think it was fair that people could delete others' posts, so maybe it's the opening post of a thread you're wanting to delete?
[-] The following 1 user Likes Laird's post:
  • Sciborg_S_Patel
(2024-07-15, 12:57 AM)Laird Wrote: I haven't deliberately changed anything, and none of the other admins are active so they wouldn't have either, so I don't know what's going on there. We did a while back disable the deleting of threads just because we didn't think it was fair that people could delete others' posts, so maybe it's the opening post of a thread you're wanting to delete?

I seeem to recall seeing (and occasionally using) a "delete" option for individual posts in a thread.
[-] The following 2 users Like nbtruthman's post:
  • Sciborg_S_Patel, Laird
Test post by test non-admin account of Laird's to see whether I see the delete button.

Edit: nope, it's gone as you say. Will debug and try to work out why.
(This post was last modified: 2024-07-15, 10:14 PM by Non-Admin Test User. Edited 1 time in total.)
[-] The following 1 user Likes Non-Admin Test User's post:
  • Sciborg_S_Patel
OK, I think I've fixed this.

The problem was subtle: a comparison in MyBB core code between a variable and the integer 0 assumed that the comparison would be true when the variable is an empty string, but that is no longer the case in PHP 8, to which (PHP 8) I upgraded our hosted psiencequest.net domain a little while back when it (finally, good Lord) was made available by Hostgator. I've updated the comparison in that core code to use boolean false rather than integer 0.

I've added filing an issue (bug report) on GitHub for this to my (long) list of other MyBB issues requiring a bug report.

If my fix is overwritten in a subsequent upgrade prior to the issue being fixed, here's a record of the fix that will need to be replicated:

Change line 630 of inc/functions_post.php from:
PHP Code:
<?php if($mybb->user['uid'] == $post['uid'] && $thread['closed'] == 0)
to:
PHP Code:
<?php if($mybb->user['uid'] == $post['uid'] && $thread['closed'] == false)
[-] The following 2 users Like Laird's post:
  • nbtruthman, Typoz
This post has been deleted.
Test post for display formatting
[-] The following 2 users Like nbtruthman's post:
  • Laird, Sciborg_S_Patel
(2024-07-15, 11:47 PM)nbtruthman Wrote: Test post for display formatting

Yeah, there were more problems in core code caused by changes to the output of the `highlight_string()` function. I think I've fixed them. I'll again make a note to (eventually, I hope) file a bug report for this on GitHub. In the meantime, here's a record of the fix we might need to reimplement after an upgrade:

Replace lines 1118-1120 of inc/class_parser.php:
PHP Code:
<?php $code = preg_replace('#<code>\s*<span style="color: \#000000">\s*#i', "<code>", $code); $code = preg_replace("#</span>\s*</code>#", "</code>", $code); $code = preg_replace("#</span>(\r\n?|\n?)</code>#", "</span></code>", $code);
with:
PHP Code:
<?php $code_new = preg_replace('#<code>\s*<span style="color: \#000000">\s*#i', "<code>", $code); if ($code_new != $code) { $code = $code_new; $code = preg_replace("#</span>\s*</code>#", "</code>", $code); } else { // PHP 8.3 returns different HTML from highlight_string() $code = preg_replace('#<code style="color: \#000000">\s*#i', "<code>", $code); // Mark our <pre> tags so we can avoid nl2br() later. $code = str_replace('<pre>', '<pre class="no_nl2br">', $code); }

And replace lines 246-275 of that same file:
PHP Code:
<?php if(!empty($this->options['allow_mycode'])) { // Now that we're done, if we split up any code tags, parse them and glue it all back together if(count($code_matches) > 0) { foreach($code_matches as $text) { if(my_strtolower($text[1]) == "code") { // Fix up HTML inside the code tags so it is clean $text[2] = $this->parse_html($text[2]); $code = $this->mycode_parse_code($text[2]); } elseif(my_strtolower($text[1]) == "php") { $code = $this->mycode_parse_php($text[2]); } $message = preg_replace("#\<mybb-code>\n?#", $code, $message, 1); } } } if(!isset($this->options['nl2br']) || $this->options['nl2br'] != 0) { $message = nl2br($message); // Fix up new lines and block level elements $message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message); $message = preg_replace("#(&nbsp;)+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message); }
with:
PHP Code:
<?php if(!isset($this->options['nl2br']) || $this->options['nl2br'] != 0) { $message = nl2br($message); // Fix up new lines and block level elements $message = preg_replace("#(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*<br />#i", "$1", $message); $message = preg_replace("#(&nbsp;)+(</?(?:html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message); } if(!empty($this->options['allow_mycode'])) { // Now that we're done, if we split up any code tags, parse them and glue it all back together if(count($code_matches) > 0) { foreach($code_matches as $text) { if(my_strtolower($text[1]) == "code") { // Fix up HTML inside the code tags so it is clean $text[2] = $this->parse_html($text[2]); $code = $this->mycode_parse_code($text[2]); if(!isset($this->options['nl2br']) || $this->options['nl2br'] != 0) { $code = nl2br($code); } } elseif(my_strtolower($text[1]) == "php") { $code = $this->mycode_parse_php($text[2]); // Support PHP 8.3's new highlight_string() HTML output as called // from our mycode_parse_php() method. $code_new = str_replace('<pre class="no_nl2br">', '<pre>', $code); if($code_new != $code) { $code = $code_new; } elseif(!isset($this->options['nl2br']) || $this->options['nl2br'] != 0) { $code = nl2br($code); } } $message = preg_replace("#\<mybb-code>(<br />)?\n?#", $code, $message, 1); } } }

Also, edit the templates `mycode_php` and `mycode_code` to strip the trailing `<br />`.
(This post was last modified: 2024-07-16, 05:10 PM by Laird. Edited 2 times in total. Edit Reason: Update the fix slightly, esp. for backwards compatibility, and add a template-editing note )
[-] The following 2 users Like Laird's post:
  • Sciborg_S_Patel, nbtruthman

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)